question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.visually-hidden-focusable should also apply to :focus-within

See original GitHub issue

Currently the visually-hidden-focusable class only shows elements which are directly focused. It is however rather common to have a single hidden element which contains two or more anchors to skip to content, navigation, footer etc.

As it is right now this is rather cumbersome and requires manual styling/classes. Changing the class to also show elements when the focus-within pseudo-class applies should not break things and simplifies this a lot.

The only cases where this would break stuff is if one was using nested focusable elements (e.g. a link inside a button - which I don’t even know if something like that is allowed) and depends on the behaviour that focusing the element would hide and therefore unfocus both of them.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
patrickhlaukecommented, Dec 11, 2020

i think keeping the same class wouldn’t be a problem, as long as it’s properly documented. giving this a whirl to see how it ends up…

0reactions
ffooddcommented, Dec 14, 2020

I really like it, and as @septatrix said, there shouldn’t be any side-effect if there’s no nested focusable elements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visually hidden
Use .visually-hidden-focusable to visually hide an element by default, but to display it when it's focused (e.g. by a keyboard-only user) ...
Read more >
visibility:hidden - focus test
Hidden elements - focus test. These buttons are hidden in different ways. Let's see if they are focusable! Even-numbered buttons are hidden using...
Read more >
Visually hidden
Use .visually-hidden-focusable to visually hide an element by default, but to display it when it's focused (e.g. by a keyboard-only user) ...
Read more >
Bootstrap 5 Visually hidden
The visually-hidden-focusable class can also be applied to a container by using :focus-within, the container will be displayed when any ...
Read more >
The 'visually-hidden' technique. Sometimes you want to ...
Some people use the tab key to navigate across focusable elements on a webpage. Such sighted keyboard users get puzzled when a “visually-hidden”...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found