Skip to content

Dropdown

What component has ​

When dropdown is closed, the focus returns to the trigger.

Keyboard support ​

Keyboard support
KeyFunction
Tab, Moves focus cyclically through all focusable elements in the dropdown, including the dropdown container.
Space , EnterOn the trigger: opens the dropdown.
EscCloses the dropdown.

Roles & attributes ​

The following list describes roles and attributes that the component already has.

Default roles and attributes
ComponentAttributeUsage
Dropdown.Triggerrole="button"Ideintifies the element as a clickable button.
Dropdown.Triggeraria-haspopup="dialog"Indicates that the element triggers a dialog.
Dropdown.Triggeraria-controls="IDREF"Identifies the element that serves as the dropdown popper.
Dropdown.Triggeraria-expanded="true" or "false"Indicates whether the dropdown is open.
Dropdown.Popperrole="dialog"Identifies the element as a dialog, indicating that its content is grouped and separated from the rest of the page content.

Considerations for developers ​

The following list will help you to keep in mind the necessary roles and attributes to make our components fully accessible in your interfaces.

Recommended roles and attributes
ComponentAttributeUsage
Dropdown.Popperaria-label or aria-labelledbyDefines an accessible name for the dropdown popper. We recommend using aria-labelledby connected to the dropdown trigger, as shown in the example.

Other recommendations ​

Find more accessibility recommendations in the common Accessibility guide.

Released under the MIT License.

Released under the MIT License.