-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dialog, dialog-full-screen, sidebar): make overflowing content tabbale #7052
base: master
Are you sure you want to change the base?
Conversation
c2ee628
to
0164a65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good stuff @tomdavies73 👏
|
||
elements.push(...focusableElements); | ||
|
||
const scrollableElements = Array.from( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: I don't think we need to have an array here as it will only ever return one or zero elements with how are modals are currently structured. We may also be able to use contains
to check if the found element contains anything focusable
const scrollableElement = ref.querySelector(defaultScrollableSelectors);
if (!scrollableElement) {
return;
}
if (
scrollableElement.scrollHeight > scrollableElement.clientHeight &&
(window.getComputedStyle(scrollableElement).overflowY === "scroll" ||
window.getComputedStyle(scrollableElement).overflowY === "auto") &&
!focusableElements.some(el => scrollableElement.contains(el))
) {
scrollableElement.setAttribute("tabindex", "0");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy for this to be non-blocking if you find any issues or prefer your way as as far as I can tell it works etc
@@ -5,6 +5,9 @@ type CustomRefObject<T> = { | |||
const defaultFocusableSelectors = | |||
'button:not([disabled]), [href], input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]'; | |||
|
|||
const defaultScrollableSelectors = | |||
'div[data-role="sidebar-content"], div[data-role="dialog-content"], div[data-role="dialog-full-screen-content"]'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (non-blocking): it might be worth using data-component
here so we're consistent with the other DOM query based implementations we have
…bbable When any of the components' content containers overflow and contain no interactive elements, the container will be added to the tabbing order and can be focused via keyboard navigation to ensure their contents are accessible fix #6999
774db78
fix #6999
Proposed behaviour
When any of the components' content containers overflow and contain no interactive elements, the container will be added to the tabbing order and can be focused via keyboard navigation to ensure their contents are accessible.
Current behaviour
Currently, some overflowing content is inaccessible due to being in an overflowing container with no interactive elements.
Checklist
d.ts
file added or updated if requiredQA
Additional context
Testing instructions