Popover

Accessibility

Accessibility props

PropTypeDefaultDescription
ariaLabelstringAdds aria-label to the popover content, providing a description for screen readers.
ariaLabelledbystringReferences the ID of an element that labels the popover content for screen readers.
role"dialog" \| "menu" \| "grid" \| "listbox" \| "tree""dialog"Defines the ARIA role of the popover component.
labelCloseReact.Node"Close"The label for the close button displayed on mobile devices.

Automatic Accessibility Features

  • aria-controls: Links the trigger element to the popover content using a unique ID or id provided via props.
  • aria-haspopup: Indicates that the trigger reveals additional content (set to the popover’s role).
  • aria-expanded: Indicates whether the popover is currently visible or hidden.

Best practices

Non-interactive trigger elements

<Popover content="Popover content">
<Button asComponent="div">Open popover</Button>
</Popover>

Descriptive labels

  • Provide meaningful ariaLabel or ariaLabelledby props to help screen reader users understand the purpose of the popover.
  • The ariaLabel should be concise but descriptive, such as “Passenger selection” or “Filter options”.
  • When using ariaLabelledby, ensure the referenced element (by ID) contains clear, descriptive text that explains the popover’s purpose.
  • Always ensure that ariaLabel text and any text in elements referenced by ariaLabelledby are properly translated to match the user’s language.
// Using ariaLabel
<Popover ariaLabel="Passenger selection options" content={passengerSelectionContent}>
<Button asComponent="div">Select passengers</Button>
</Popover>
// Using ariaLabelledby
<div>
<h2 id="passenger-selection-heading">Passenger selection</h2>
<Popover ariaLabelledby="passenger-selection-heading" content={passengerSelectionContent}>
<Button asComponent="div">Select passengers</Button>
</Popover>
</div>

Custom close label

<Popover content="Popover content" labelClose="Close passenger selection">
<Button asComponent="div">Select passengers</Button>
</Popover>

Keyboard navigation

  • The popover can be opened by pressing Enter or Space when the trigger element has focus.
  • When open, the popover can be closed by pressing Escape.
  • Focus is properly managed within the popover when it’s open.

Appropriate roles

  • Use "dialog" (the default) for most cases, especially when presenting forms or information.
  • Use "menu" when the popover contains a list of actions or menu items.
  • Use "listbox" when presenting a list of selectable options.
  • Use "grid" for tabular data.
  • Use "tree" for hierarchical, expandable/collapsible content.

Examples

Basic popover with proper labeling

<Popover
content={<Text>This is additional information about this feature.</Text>}
ariaLabel="Feature information"
>
<Button asComponent="div">More info</Button>
</Popover>

Popover with custom role and existing label

<Stack>
<h2 id="passenger-selection">Passenger selection</h2>
<Popover
content={
<Stack>
<Stepper
minValue={0}
ariaLabelValue="Number of adult passengers"
titleIncrement="Add adult passenger"
titleDecrement="Remove adult passenger"
/>
</Stack>
}
role="menu"
ariaLabelledby="passenger-selection"
>
<Button asComponent="div" iconRight={<ChevronDown />}>
Select passengers
</Button>
</Popover>
</Stack>