JavaScript Element ariaHasPopup Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline
Instance property

What You’ll Learn

Element.ariaHasPopup is an instance property that reflects the aria-haspopup attribute. Learn tokens like listbox, menu, and dialog, how they describe popup availability, and how to get or set the property from JavaScript—with five examples and try-it labs.

01

Kind

Instance property

02

Type

String

03

Values

false · true · menu · …

04

Reflects

aria-haspopup

05

Status

Baseline widely

06

Pairs with

ariaExpanded

Introduction

Some controls open a popup: a menu, a listbox, a dialog, and more. Assistive technologies need to know that a popup is available and what kind it is.

aria-haspopup carries that signal. ariaHasPopup is the JavaScript reflection of that attribute.

JavaScript
const el = document.getElementById("animal");
console.log(el.ariaHasPopup); // "true"
el.ariaHasPopup = "listbox";
💡
Beginner tip

Prefer the most specific token that matches the popup. For a combobox that opens a listbox, use "listbox" (MDN) rather than a generic "true". Pair with ariaExpanded for open/closed state.

Understanding the Property

MDN: the ariaHasPopup property of the Element interface reflects the value of the aria-haspopup attribute, which indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.

  • Reflected attribute — mirrors aria-haspopup.
  • Get / set — readable and writable string.
  • Several tokens — false, true, menu, listbox, tree, grid, dialog.
  • Baseline — widely available since October 2023 (MDN).

📝 Syntax

JavaScript
ariaHasPopup

Value

A string with one of the following values:

ValueMeaning (MDN)
"false"The element does not have a popup.
"true"The element has a popup that is a menu.
"menu"The element has a popup that is a menu.
"listbox"The element has a popup that is a listbox.
"tree"The element has a popup that is a tree.
"grid"The element has a popup that is a grid.
"dialog"The element has a popup that is a dialog.
⚠️
Support warning (MDN)

Support for different aria-haspopup values can vary by element. Follow the ARIA specification for your pattern and test with browsers and assistive technologies.

📋 Combobox (MDN Shape)

MDN starts with aria-haspopup="true" on a combobox, then updates to "listbox"—the expected value when the popup is a listbox:

JavaScript
<div class="animals-combobox">
  <label for="animal">Animal</label>
  <input
    id="animal"
    type="text"
    role="combobox"
    aria-autocomplete="list"
    aria-controls="animals-listbox"
    aria-expanded="false"
    aria-haspopup="true" />
  <ul id="animals-listbox" role="listbox" aria-label="Animals">
    <li id="animal-cat" role="option">Cat</li>
    <li id="animal-dog" role="option">Dog</li>
  </ul>
</div>
JavaScript
let el = document.getElementById("animal");
console.log(el.ariaHasPopup); // true
el.ariaHasPopup = "listbox";
console.log(el.ariaHasPopup); // listbox

⚡ Quick Reference

GoalCode / note
Readel.ariaHasPopup
Combobox listboxel.ariaHasPopup = "listbox"
Menu buttonel.ariaHasPopup = "menu"
No popupel.ariaHasPopup = "false"
Open/close stateUse ariaExpanded separately
MDN statusBaseline Widely available

🔍 At a Glance

Four facts about Element.ariaHasPopup.

Kind
get / set

Instance

Type
string

Popup kind

Reflects
aria-haspopup

Attribute

Baseline
widely

Oct 2023+

Examples Gallery

Examples follow MDN Element: ariaHasPopup. Labs use a combobox-style input so you can safely read and write the property.

📚 Getting Started

Read the reflected value and follow MDN’s listbox update.

Example 1 — Read ariaHasPopup

Log the current popup token from a combobox.

JavaScript
const el = document.getElementById("animal");
console.log(el.ariaHasPopup);

// HTML includes: aria-haspopup="true"
Try It Yourself

How It Works

The property returns the attribute string. If the attribute is missing, many browsers return null.

Example 2 — MDN Update to "listbox"

MDN: change from "true" to the specific listbox token.

JavaScript
let el = document.getElementById("animal");
console.log(el.ariaHasPopup); // true
el.ariaHasPopup = "listbox";
console.log(el.ariaHasPopup); // listbox
Try It Yourself

How It Works

Assigning the property updates the reflected aria-haspopup attribute so assistive technologies know the popup type.

📈 Menu Token, Attribute Sync & Snapshot

Practice other popup kinds and verify reflection.

Example 3 — Set "menu"

Mark a button that opens a menu popup.

JavaScript
const btn = document.createElement("button");
btn.textContent = "Options";
document.body.appendChild(btn);

btn.ariaHasPopup = "menu";
console.log({
  ariaHasPopup: btn.ariaHasPopup,
  attr: btn.getAttribute("aria-haspopup")
});
Try It Yourself

How It Works

Use "menu" (or "true") for menu popups, "dialog" for dialogs, and so on—match the actual popup role.

Example 4 — Property vs getAttribute

Confirm the attribute stays in sync after a write.

JavaScript
const el = document.createElement("input");
el.setAttribute("role", "combobox");
el.setAttribute("aria-haspopup", "true");
document.body.appendChild(el);

el.ariaHasPopup = "listbox";
console.log({
  fromProperty: el.ariaHasPopup,
  fromAttribute: el.getAttribute("aria-haspopup"),
  same: el.ariaHasPopup === el.getAttribute("aria-haspopup")
});
Try It Yourself

How It Works

Prefer ariaHasPopup in script; keep the attribute for HTML markup.

Example 5 — Support Snapshot

Feature-detect and list the allowed tokens.

JavaScript
console.log({
  supported: "ariaHasPopup" in Element.prototype,
  allowed: ["false", "true", "menu", "listbox", "tree", "grid", "dialog"],
  tip: "Prefer specific tokens (listbox, menu, dialog) over true when possible",
  status: "Baseline Widely available (MDN)"
});
Try It Yourself

How It Works

Keep ariaHasPopup aligned with the real popup role, and use ariaExpanded for whether that popup is open.

🚀 Common Use Cases

  • Comboboxes that open a listbox popup.
  • Menu buttons that open a menu.
  • Buttons that open a dialog.
  • Tree or grid pickers with matching popup tokens.
  • Keeping script and markup aligned without manual setAttribute.

🔧 How It Works

1

Control can trigger a popup

Menu, listbox, dialog, tree, or grid.

Widget
2

Set ariaHasPopup to the popup kind

Prefer specific tokens like listbox or menu.

Declare
3

Toggle ariaExpanded when opening

Has-popup describes type; expanded describes open state.

State
4

Assistive tech announces the popup type

Users know a menu, listbox, or dialog can appear.

📝 Notes

  • Not Deprecated, Experimental, or Non-standard on MDN (Baseline Widely available).
  • Prefer specific tokens over generic "true" when possible.
  • Test patterns with browsers and assistive technologies (MDN warning).
  • Related: ariaHidden, ariaExpanded, EventTarget, JavaScript hub.

Browser Support

Element.ariaHasPopup is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.

Baseline Widely available

Element.ariaHasPopup

String false / true / menu / listbox / tree / grid / dialog — reflects aria-haspopup.

Baseline Widely available
Google Chrome Supported (ARIA reflection)
Yes
Microsoft Edge Supported (ARIA reflection)
Yes
Mozilla Firefox Supported (ARIA reflection)
Yes
Apple Safari Supported (ARIA reflection)
Yes
Opera Follow Chromium support
Yes
Internet Explorer No ariaHasPopup IDL — use setAttribute
No
ariaHasPopup Baseline

Bottom line: Use ariaHasPopup to declare popup availability and type. Prefer specific tokens. Pair with ariaExpanded for open/closed state, and test your widget pattern with AT.

Conclusion

ariaHasPopup reflects aria-haspopup so controls can advertise which kind of popup they trigger. Prefer specific tokens like listbox and menu, keep ariaExpanded in sync for open/closed state, and test with assistive technologies.

Continue with ariaHidden, ariaExpanded, EventTarget, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Match the token to the real popup role
  • Prefer listbox / menu / dialog over bare true
  • Pair with ariaExpanded for open/closed
  • Point to the popup with aria-controls when useful
  • Test with screen readers for your pattern

❌ Don’t

  • Claim a popup type you do not implement
  • Confuse has-popup with expanded state
  • Skip keyboard open/close behavior
  • Assume every value works identically on every element (MDN)
  • Forget an accessible name on the trigger

Key Takeaways

Knowledge Unlocked

Five things to remember about ariaHasPopup

Reflected aria-haspopup string for popup availability and type.

5
Core concepts
📝 02

Many tokens

listbox menu dialog…

Values
🔍 03

Be specific

prefer over true

Rule
04

Baseline

widely available

Status
🎯 05

ariaExpanded

open / closed

Pair

❓ Frequently Asked Questions

It reflects the aria-haspopup attribute as a string, indicating the availability and type of interactive popup (menu, listbox, dialog, and so on) that can be triggered by the element.
No. MDN marks Element.ariaHasPopup as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
The strings "false", "true", "menu", "listbox", "tree", "grid", or "dialog". Prefer the specific type that matches the popup (for example "listbox" for a combobox).
"true" means the element has a popup that is a menu (same idea as "menu"). Prefer the more specific token when you can.
ariaHasPopup describes the kind of popup available. ariaExpanded says whether that popup is currently open or closed.
Yes. Reading and writing ariaHasPopup updates the reflected aria-haspopup attribute. Test with browsers and assistive technologies for your widget pattern.
Did you know?

Historically many examples used aria-haspopup="true" for menus. Modern guidance prefers naming the popup type explicitly—MDN’s combobox demo updates true to listbox for that reason.

Next: Element ariaHidden

Learn the reflected aria-hidden property for accessibility API exposure.

ariaHidden →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful