Skip to content
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

Un-inert doesn't remove tabindex=-1 if inert was applied to elements, which was selected by * #118

Closed
archual opened this issue Dec 26, 2018 · 3 comments

Comments

@archual
Copy link

archual commented Dec 26, 2018

I tried to apply inert attribute to all child elements of certain node, using selector like '.main '. it adds inert attribute to all elements in dome under .main node, also this adds tabindex and aria-hidden. But when I remove inert by using selector '[inert]' and removeAttribure - inert and aria-hidden attribute are removed, but tabindex keeps in elements, and elements can't be focused.

All works if I use specific selector like '.main span' or '.main .links'.
Looks like * selector broke inert polyfill or it can't work with elements, which was getting bu such selector.

@bkardell
Copy link
Collaborator

Are you saying that you did a querySelectorAll with a * at the end and then looped through applying inert? Any chance you can share a test/codepen or something illustrating?

@archual
Copy link
Author

archual commented Feb 4, 2019

Sorry for late answer.
I tried to repeat my old code, where I use * selector, but it works fine on codepen, might be because I use simple code. And might be early my code worked bad, because I used inert in bad way: I got all elements exclude popup form, than I filter them by focusible and apply inert for these elements in cicle:
var $allRootElementsExcludePopup = $('body > *').not(popup); var $elementsToInert = $(":focusable", $allRootElementsExcludePopup); $.each($elementsToInert, function(index, value) { if (value.getAttribute('inert') === null) { value.setAttribute('inert', ''); } else { value.removeAttribute('inert'); } })

I have rewrote this old code already and now inert works very well.

@robdodson
Copy link
Collaborator

ok I'll close this issue then. Let us know if you still have problems :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants