Skip to content

aria-haspopup — Indicating Popup Elements to Screen Readers

DodaTech Updated 2026-06-28 2 min read

In this tutorial, you will learn about aria. We cover key concepts, practical examples, and best practices to help you master this topic.

aria-haspopup indicates that an interactive element triggers a popup widget like a menu, dialog, listbox, tree, or grid, helping screen reader users understand what will appear.

In this tutorial, you'll learn how to use aria-haspopup in ARIA.

What You'll Learn

By the end of this lesson, you'll understand the five aria-haspopup values, how to pair it with aria-expanded, and the expected keyboard interaction.

Why It Matters

Without aria-haspopup, screen reader users do not know that activating a button will open a menu, dialog, or other popup. They lose context and trust.

Real-World Use

Doda Browser's menu bar uses aria-haspopup="menu" on each top-level menu item so screen reader users know activating it opens a submenu.

flowchart TD
  A[aria-haspopup values] --> B[menu]
  A --> C[listbox]
  A --> D[tree]
  E[grid]
  A --> F[dialog]
  A --> G[true]
  B --> H[Submenu opens]
  C --> I[List of options opens]
  D --> J[Tree view opens]
  E --> K[Grid opens]
  F --> L[Dialog opens]
  G --> M[Unknown popup type]

How aria-haspopup Works

aria-haspopup is set on the element that triggers the popup:

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

The screen reader announces "File, button, has popup menu, collapsed".

aria-haspopup Values

Value Meaning
menu Opens a menu
listbox Opens a listbox
tree Opens a tree view
grid Opens a grid
dialog Opens a dialog
true Popup of unknown type (deprecated, use specific)
<button aria-haspopup="menu">Open menu</button>
<button aria-haspopup="dialog">Open dialog</button>
<button aria-haspopup="listbox">Show options</button>

Pairing With aria-expanded

Always use aria-haspopup with aria-expanded to indicate visibility:

<button aria-haspopup="dialog" aria-expanded="true" aria-controls="settings-dialog">
  Settings
</button>
<div id="settings-dialog" role="dialog" aria-modal="true">
  <!-- dialog content -->
</div>

Common Mistakes

  • Using aria-haspopup="true" instead of a specific value: Use the specific popup type.
  • Forgetting aria-expanded: Tell users whether the popup is currently visible.
  • Not implementing keyboard interaction: Popups must be keyboard accessible.
  • Setting aria-haspopup on the popup itself: It goes on the triggering element.
  • Using aria-haspopup on non-interactive elements: The trigger must be focusable.

Practice and Challenge

1. What does aria-haspopup="menu" indicate? Activating this element opens a menu.

2. What attribute should pair with aria-haspopup? aria-expanded.

3. What aria-haspopup value should you use for a modal dialog? dialog.

4. Why is aria-haspopup="true" deprecated? It does not tell users what type of popup to expect.

5. Challenge: Create a button that opens a dialog. Use aria-haspopup="dialog" and aria-expanded. Manage focus when the dialog opens and closes.

FAQ

Does aria-haspopup make an element open a popup?

No. It only communicates the intention. You must implement the popup behavior.

Can I use aria-haspopup on a link?

Yes, if the link opens a popup instead of navigating.

Should I use aria-haspopup on accordions?

No. Accordions expand content, they do not trigger popups.

What is the difference between menu and listbox?

Menu contains menuitems with actions. Listbox contains options for selection.

Does aria-haspopup affect keyboard behavior?

No. It only provides information to screen readers.

Mini Project

Build a toolbar with a button that opens a dropdown menu. Use aria-haspopup="menu" and aria-expanded. Implement full keyboard navigation for the menu.

What's Next

Continue to aria-modal to learn about indicating modal dialogs.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro