Good accessibility usually starts with clear words and the right HTML elements, not a large amount of extra code.
What You Need to Know
A popover is useful for temporary nonmodal content such as extra options. Check that keyboard users can reach it and dismiss it, and that focus returns to a sensible place when it closes.
Try the Example
Take a look at the example. We’ll explain the important lines right below it.
<button type="button" popovertarget="account-help">Account help</button>
<div id="account-help" popover="auto">
<h2>About your account</h2>
<p>Your account saves your class projects.</p>
</div>
Let’s Read the Code
- popover: Popover lets supported browsers manage showing and hiding a small overlay.
- <button>: The button offers an action; its type or command determines what happens.
- <h2>: A heading divides the page into understandable parts.
- type: Type changes what sort of control or resource the browser uses.
What the example shows: A popover offers a small piece of nonmodal help without taking the visitor through a full task flow.
What Happens in the Browser?
Try this with Tab and Shift+Tab. If you can, inspect the accessibility tree too; appearance alone does not tell the whole story.
A quick keyboard check: Press Tab to move forward, Shift+Tab to go back, and Enter or Space to activate controls when appropriate. Watch where focus goes. If you cannot tell which control is active, the interface needs improvement.
Your Turn
Open and close the popover using only the keyboard.
Common Beginner Mistakes
- Judging the page only by how it looks, without checking its meaning and keyboard behavior.
- Always check keyboard focus, Escape, and click-away behavior; a popover is not automatically a modal.
Key Takeaways
- A popover is useful for temporary nonmodal content such as extra options.
- popover: Popover lets supported browsers manage showing and hiding a small overlay.
- A meaningful HTML element is usually a stronger starting point than adding an ARIA role to a generic div. Also check what happens using only the keyboard.