react-spectrum
react-spectrum copied to clipboard
Flex/Grid/View: add support for landmark role and labelling
๐ Feature Request
Flex, Grid, and View are popularly used as generic containers for controlling layout.
For accessibility, it would be helpful if:
- one could add a WAI-ARIA landmark role
- the element could be rendered using an HTML5 landmark elementType
- when using a landmark role or HTML5 elementType, the element should support labeling using aria-label or aria-labelledby.
๐ค Expected Behavior
Support optional role prop restricted to the following WAI-ARIA landmark roles:
Also, so that flex can be use within components that expect particular children, like a list or a table:
Support optional elementType prop restricted to the following HTML5 landmark tags:
- aside
- footer
- form
- header
- main
- nav
- section
When either role or elementType is used, support labeling of the rendered element using aria-label or aria-labelledby.
๐ฏ Current Behavior
Flex, Grid, and View do not support role, aria-label, or aria-labelledby, and are only rendered using the div element. In order to add a landmark, one would have to either wrap the component or its children in a landmark element, setting display: contents to avoid breaking layouts, but this changes the DOM structure, and could break fragile tests. During remediation, it is oftentimes simpler to add WAI-ARIA roles than to change the DOM structure.
๐ Possible Solution
๐ฆ Context
๐ป Examples
๐งข Your Company/Team
Adobe/Accessibility