Elements are aria-hidden but still focusable by DevTools extension
Product: axe-core DevTools extension
Expectation: Buttons in the banner and navigation landmark (children of parent element <div id="app">) should not be focusable when a modal is open which sets aria-hidden="true" on parent div (<div id="app" aria-hidden="true">)
Actual: Buttons in banner and navigation elements are flagged as "focusable" (even though they are children of an aria-hidden element) by DevTools
Motivation: Not a true error? This doesn't appear to be an issue when using the app by keyboard alone, or when using voiceover on an iPhone: the tab remains in the modal, and does not focus on the buttons in the banner and navigation unless the modal is closed.
possibly same issue as described in #2961
Screenshots:
the app in the state the devtools scan was performed (with dialog open and aria-hidden="true" on the parent div) everything in a red box is flagged as focusable:

The devtools output listing as related nodes every item in the left column navigation menu list, and every button in the top header bar, even though I cannot tab to them or click on them once the modal is opened.

axe-core version: 4.2.0
axe-devtools extension version: 4.9.3
Browser and Assistive Technology versions
Chrome: Version 91.0.4472.101
Safari and Voiceover apps used on iPhone 11 iOS: 14.6
For Tooling issues:
- Node version: 10.14.1
- Platform: Mac
Thanks for the issue. aria-hidden=true does not prevent focus on elements as it only hides the element from screen readers but not keyboard users. To truly remove focus from elements you'd have to add tabindex=-1 to all focusable descendants of the aria-hidden element. A good way to do that is to use the inert polyfill and set inert on the aria-hidden element and it will do the rest.
My guess is you have a tab trap on the modal and that's why you can't focus the rest of the page when inside of it. Tab traps can be broken out of by not using the tab button and instead using the next line button (arrow up/down in Safari/VO), which would then start letting the user tab / move around the page while everything is hidden.
Hi, thanks for the response.
"aria-hidden=true does not prevent focus on elements as it only hides the element from screen readers but not keyboard users"
- I cannot reach the "focusable" elements behind the modal with the keyboard, once the modal is open the keyboard focus remains only in the modal until the user uses the keyboard to exit it, so it appears to be working as expected with the keyboard. I don't think there is a tab trap.
Is the page in question public that I could take a look at?
Sure, I've made a temp account so you can access and take a look:
https://m.cozi.com/login
login: [email protected] pw: test0000
repro steps:
- after logging in, navigate to "Calendar" via the navigation menu on the left of the screen
- click on one of the holidays in the calendar view, and a dialog should open up
- this is the state in which I run the axe tool, with the dialog open.
Note: running the tool on this deployment, will only highlight the buttons in the top bar as "focusable", but in the next deployment where we do some bug fixes on the navigation menu on the left side, those menu items also become "focusable" with the dialog open.
Thanks very much, let me know if you need anything else to repro.
Thanks for that page, it was very helpful.
So it looks like material ui has some script where it forces the active element to always be inside the modal. For example, if I save one of the top nav items before the modal is open, and then open the modal, I can enter el.focus() in the console and it will focus the element (document.activeElement === el). But as soon as I refocus the browser window material ui focuses the dialog (blur event is called with npm.meterial-ui.chunck.js being the cause of the call).
So you're right this isn't a typical tab trap as normally those can be broken out of. I'll have to pass this around internally and see what people think or know of this technique.
This page is definitely problematic when accessed using a screen reader. I have not tested on all of them but in terms of ensuring accessibility without problems, what you need to do is ensure that naturally focusable elements such as buttons inside areas that have aria-hidden="true" should set tabindex="-1" to remove natural focus while the dialog is up
Apart from that, something on the page caused the screen reader to get really confused at times. The funky focus trapping code combined withe the iframes with focusable elements might be the cause.
thanks for the info, I will make another attempt at setting the tabIndex
Marking this as resolved.