Popover
Popovers are small overlays that open on demand. They let merchants access additional content and actions without cluttering the page.
Props
No props found for this component, run `yarn gen:docs` to generate component meta first.
Slots
No slots found for this component, run `yarn gen:docs` to generate component meta first.
Events
Best practices
Popovers should:
- Always be positioned next to the button or other interface element that triggers them
- Be used for secondary or less important information and actions since they’re hidden until merchants hit the trigger
- Contain navigation or actions that share a relationships to each other
- Be triggered by a clearly labeled button
- Use a default or tertiary button as the activator
Content guidelines
Popover content
If a popover contains actions, they should:
- Be clear and predictable: merchants should be able to anticipate what will happen when they click on an action item. Never deceive merchants by mislabeling an action.
- Be action-led: buttons should always lead with a strong verb that encourages action. To provide enough context to merchants use the {verb}+{noun} format on buttons except in the case of common actions like Save, Close, Cancel, or OK.
- Be scannable, especially when the popover contains a list of actions or options. Avoid unnecessary words and articles such as “the”, “an”, or “a”.
If the popover includes a series of navigational links, each item should:
- Be concise but still give merchants enough information so they can easily find and accurately navigate to the path they want.
Related components
- To put a list of actions in a popover, use the action list component
- To let merchants select simple options from a list, use the select component
Accessibility
Popovers usually contain an option list or an action list, but can also contain other controls or content.
To assist screen readers with sending focus to an action list, pass autofocusTarget='first-node'
to Popover
. This will avoid known issues a screen reader may have with keyboard support once focus is moved off the activator.
Web browsers assign a default value of 'menu' to the aria-haspopup
role. You can use the prop ariaHaspopup
to specify a value. Screen readers may fail to send focus to the Popover
content when they expect the content to be adjacent to the element with aria-haspopup
in the DOM tree. In this scenario, it is recommended not to provide the ariaHaspopup
prop.
Keyboard support
- When a popover opens, focus moves to the first focusable element or to the popover container
- Once focus is in the popover, merchants can access controls in the popover using the tab key (and shift + tab backwards) and standard keystrokes for interacting
- Merchants can dismiss the popover by tabbing out of it, pressing the esc key, or clicking outside of it
- When the popover is closed, focus returns to the element that launched it