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

Don't allow tabbing to elements inside hidden parents #556

Conversation

benadamstyles
Copy link
Contributor

What: Don't allow tabbing to elements inside hidden parents.

Why: I think this correctly matches browser behaviour.

How: Add a !el.closest('[hidden]') check in the focusable elements filter.

Checklist:

  • Documentation N/A
  • Tests
  • Typings N/A
  • Ready to be merged

@codecov
Copy link

codecov bot commented Feb 11, 2021

Codecov Report

Merging #556 (298cd9f) into master (217b487) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #556   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          696       698    +2     
  Branches       218       220    +2     
=========================================
+ Hits           696       698    +2     
Impacted Files Coverage Δ
src/tab.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 217b487...462a5a8. Read the comment docs.

@ph-fritsche
Copy link
Member

Thanks for the report. Yes, we should exclude hidden elements. :)

But while elements with hidden attribute should not contain elements that are relevant for the user, they are still displayed and available if a stylesheet overwrites display.

<input/>
<button hidden style="display: inline-block">click</button>
<input />

So we need to traverse the ancestors and verify if they are visible.

I've opened benadamstyles#1 with a solution.
But the bug in jsdom causing window.getComputedStyle() to ignore hidden attributes has to be resolved first.

@ph-fritsche
Copy link
Member

Replaced by #579

@ph-fritsche ph-fritsche closed this Mar 9, 2021
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

Successfully merging this pull request may close these issues.

2 participants