adobe / react-spectrum

A collection of libraries and tools that help you build adaptive, accessible, and robust user experiences.
https://react-spectrum.adobe.com
Apache License 2.0
12.72k stars 1.09k forks source link

RAC Virtualizer content element should have `role="presentation"` #6617

Closed majornista closed 3 months ago

majornista commented 3 months ago

The generic div container that wraps the virtualized elements and provides the content height for native scrolling should have role="presentation" so that it does not break the accessibility tree structure for the containing grid, menu or listbox.

https://github.com/adobe/react-spectrum/blob/2cd8f0b509cd9a1d93322dd75fc1306e5f0e217f/packages/react-aria-components/src/Virtualizer.tsx#L65

The problem can be seen in the Virtualized RAC table at: https://reactspectrum.blob.core.windows.net/reactspectrum/ff19a7c1ca7fccfd3e46eeef1c6b71ef23f36437/storybook/index.html?path=/story/react-aria-components--virtualized-table&providerSwitcher-express=false

We may wish to return role="presentation" at: https://github.com/adobe/react-spectrum/blob/2cd8f0b509cd9a1d93322dd75fc1306e5f0e217f/packages/%40react-aria/virtualizer/src/ScrollView.tsx#L245-L247