You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Discuss] Cross-browser focus states for overflow containers #3385
accessibilityansweredIssues answered by the EUI team - auto-closes open issues in 7 days if no follow-up responsedesign decisionUse this to flag an item that needs input from the design team
We had some discussion on the resizable container scroll interactions as part of #2701 (comment), specifically around the following two issues. It was decided this is a more global issue than one component and we should think holistically at the problem.
Should EUI give guidance and adhere to applying tabindex=0 for any elements with an applied overflow: auto property.
How should EUI consistently apply styling for such a cases? How can we make this not weird specifically in auto situations where the element may or may not be scrollable.
Likely if applied, even in EUI components, there would still need to exist guidance of some sort, since EUI would not be able to control all general downstream usages, where tabindex would need to be applied manually. Potentially we could mitigate this by introducing a small component called EuiScrollableContainer that could act as a simple utility component to apply tabindex and the proper styling selectors necessary to attack this consistently.
changed the title [-][Discuss] Focus state for resizable containers cross-browser[/-][+][Discuss] Cross-browser focus states for overflow containers[/+]on Apr 24, 2020
A couple thoughts I've had on this recently, as it has also come into question via Cloud, and some notes for my future self.
In a recent update (in master only as of today) to the docs, I've included messaging on our CSS utilities page in the overflow section basically giving consumers an indication that when using these utilities, to better support a11y, they also need to add tabIndex to the container.
But, I also updated those overflow utilities to hide the focus rings from non-keyboard users with simply the :focus { outline none } style, which gets overridden for keyboard users in browsers that support :focus-visible.
There's still more to do for this though:
Audit EUI specific components to update their styles to be the same or use the utility
Safari still behaves differently from Chrome and Firefox and needs to be addressed
As an aside about :focus-visible and Safari, and my future self note, what I can gather from how Safari behaves is that it respects :focus and ignores :focus-visible. So in the above scenario, Safari will never show a focus ring. But with all other interactable, and by default, content we reverse this scenario and ensure everything that gets :focus gets a ring, but only if they support :focus-visible does it hide for mouse users.
What we probably want is some better helper for exactly these 2 scenarios.
This is directly interactable content, like a <button> and should always show a focus ring, unless the browser can support :focus-visible or (with the new CSS in JS theming) is forced by the user's preference.
This is indirectly interactable content, like an overflowing <div> which doesn't need a visible ring, but must be able to receive keyboard focus. Therefore, remove the focus ring unless the browser can support :focus-visible or (with the new CSS in JS theming) is forced by the user's preference.
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
However, guidance alone leaves responsibility in the hands of consumers to apply a tabindex="0" to relevant containers. We could build out a simple component that checks for Element.scrollHeight being larger than Element.clientHeight and applies a state or prop to include tabindex. But there again, we're asking consumers to remember to use this new element.
Additionally, some of our examples on the Scroll utility docs page do not have a visible focus halo. This doesn't pass muster for WCAG SC 2.4.7 Focus Visible. Whatever we decide to do, these examples will need to have the CSS updated to not suppress the outline.
👋 This issue hasn't seen activity in 3 days, so we're automatically closing this issue as answered. Please leave a comment if that's not the case, or if you have any remaining questions or issues.
accessibilityansweredIssues answered by the EUI team - auto-closes open issues in 7 days if no follow-up responsedesign decisionUse this to flag an item that needs input from the design team
Activity
[-][Discuss] Focus state for resizable containers cross-browser[/-][+][Discuss] Cross-browser focus states for overflow containers[/+]myasonik commentedon Apr 24, 2020
Would be a nice enhancement to only apply
tabindex=0if the content is actually scrollable, not just if it could be scrollablemyasonik commentedon Jan 29, 2021
Related Kibana issue: elastic/kibana#89490
Edit: Sorry about the miss click and the extra pings!
cchaos commentedon Mar 19, 2021
A couple thoughts I've had on this recently, as it has also come into question via Cloud, and some notes for my future self.
In a recent update (in master only as of today) to the docs, I've included messaging on our CSS utilities page in the overflow section basically giving consumers an indication that when using these utilities, to better support a11y, they also need to add
tabIndexto the container.But, I also updated those overflow utilities to hide the focus rings from non-keyboard users with simply the
:focus { outline none }style, which gets overridden for keyboard users in browsers that support:focus-visible.There's still more to do for this though:
As an aside about
:focus-visibleand Safari, and my future self note, what I can gather from how Safari behaves is that it respects:focusand ignores:focus-visible. So in the above scenario, Safari will never show a focus ring. But with all other interactable, and by default, content we reverse this scenario and ensure everything that gets:focusgets a ring, but only if they support:focus-visibledoes it hide for mouse users.What we probably want is some better helper for exactly these 2 scenarios.
<button>and should always show a focus ring, unless the browser can support:focus-visibleor (with the new CSS in JS theming) is forced by the user's preference.<div>which doesn't need a visible ring, but must be able to receive keyboard focus. Therefore, remove the focus ring unless the browser can support:focus-visibleor (with the new CSS in JS theming) is forced by the user's preference.github-actions commentedon Sep 16, 2021
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
github-actions commentedon Mar 17, 2022
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.
cchaos commentedon Mar 17, 2022
I'm keeping this in the backpocket of the Emotion conversion to evaluate per-component.
1Copenut commentedon Apr 3, 2023
I took a look at this today, and determined we have language in the EUI design system about making scrollable content keyboard focusable:
However, guidance alone leaves responsibility in the hands of consumers to apply a
tabindex="0"to relevant containers. We could build out a simple component that checks forElement.scrollHeightbeing larger thanElement.clientHeightand applies a state or prop to include tabindex. But there again, we're asking consumers to remember to use this new element.1Copenut commentedon Apr 3, 2023
Additionally, some of our examples on the Scroll utility docs page do not have a visible focus halo. This doesn't pass muster for WCAG SC 2.4.7 Focus Visible. Whatever we decide to do, these examples will need to have the CSS updated to not suppress the
outline.github-actions commentedon Apr 8, 2023
👋 This issue hasn't seen activity in 3 days, so we're automatically closing this issue as answered. Please leave a comment if that's not the case, or if you have any remaining questions or issues.