Open ahayes91 opened 2 years ago
There’s a design aspect to this too in that a focus outline needs to be accounted for when that container has overflow and has keyboard focus, and a visual treatment would help communicate visually there is actually overflow.
Low vision users have not perceived the browser generated scrollbars that are shown when a container has overflow in a recent study that included tables with overflow - so there’s an opportunity to improve this experience.
For compliance any visual treatment to communicate overflow would need to exceed the non-text contrast SC.
Here's my idea:
id
to extend from a new idModel
and make an elemPropsHook called "useOverflowContent" that takes the id
and adds a resize observer that compares the offsetHeight
and the scrollHeight
to see if the content is overflowed. It can always add style={{overflowY: 'scroll'}}
. If overflowed, it adds:
{
tabIndex={0}
role="group"
aria-labelledby={model.state.id}
}
We'll have to watch out for overflow-limiting focus rings. This shouldn't be much of a problem usually unless we have scrollable areas inside of scrollable areas. We had this problem with Modal body being overflowed with buttons
🚀 Feature Proposal
Scrollable sections in the UI should have a tabindex to allow keyboard-only users to navigate to them and scroll to access any static text. https://dequeuniversity.com/rules/axe/3.5/scrollable-region-focusable
Suggested requirements (based on the same feature we built into Workday Learning):
When there is overflow content, the container for that content requires
When there is no overflow content, the containing div for the content doesn't need any of the above.
We achieved this in Learning modals by using a resize observer that conditionally adds the role=group, aria-labelledby and tabindex if it detects overflow in the scrollable area.
Motivation
As above and in https://dequeuniversity.com/rules/axe/3.5/scrollable-region-focusable
Example
This is probably most relevant for Modal components. https://canvas.workdaydesign.com/components/popups/modal/#body-content-overflow is an example. When you minimise the screen and use keyboard only to navigate to the modal, you can’t navigate to the scrolling section and see the overflow content.
Speaking to @NicholasBoll about this internally, he had some comments: