References

Beginner-friendly references for web development, with live, editable examples.

The HTML aria-haspopup attribute

ARIA Accessibility All modern browsers Updated
Quick answer

The aria-haspopup attribute indicates that a control opens a popup, and what type it is. Values: menu, listbox, tree, grid, dialog, or true (which means menu). Use false or omit when there is no popup.

Overview

The aria-haspopup attribute indicates that an element triggers a popup such as a menu, listbox or dialog.

It is a widget property: a declaration about the widget that is normally set once, rather than a state that changes as the user interacts. Because ARIA does nothing on its own, keep it accurate and update it in JavaScript if the widget's behavior does change; a stale value is worse than none. And wherever a native element already expresses the same thing (a <textarea> for multi-line input, the required or readonly attribute, a native multiple select), use that instead.

Like all ARIA, aria-haspopup changes only the accessibility tree (what assistive technology perceives), never the element's behavior or appearance. The first rule of ARIA applies: if a native HTML element or attribute conveys this, use that instead, and only reach for ARIA when nothing native fits.

Syntax

<button aria-haspopup="menu" aria-expanded="false">Options</button>

Values

Value
false | true | menu | listbox | tree | grid | dialog

Example

Live example
<button aria-haspopup="listbox" aria-expanded="false" aria-controls="lb">Country</button>

Best practices

  • Follow the first rule of ARIA: use a native HTML element or attribute that conveys this where one exists, rather than adding ARIA.
  • Set it to match the behavior you actually implement, and change it only if that behavior changes.
  • Use the matching native attribute where one exists (required, readonly, multiple) instead of the ARIA version.
  • Set it only on an element whose role actually supports this property.

Frequently asked questions

What does aria-haspopup do?
Indicates that an element triggers a popup such as a menu, listbox or dialog.
Does setting this attribute change how the element behaves?
No. ARIA changes only what assistive technology perceives. You must implement the behavior yourself.
Do I need to update this value as the user interacts?
Usually not. A property describes the widget rather than a condition that changes, so you set it once and only revisit it if the widget's own behavior changes. That is what separates a property from a state.
Do I need aria-haspopup if native HTML already conveys it?
Usually not. ARIA is for what native HTML cannot express; redundant or incorrect ARIA can make accessibility worse. Reach for it only when no native element fits.