"role=text": no focusable descendants
See original GitHub issueI really love that ârole=textâ made it in to axe-core. So I would like to thank everyone involved at first đ
PR: https://github.com/dequelabs/axe-core/pull/2702
Product: axe-core
Expectation: Allow to have âtabindex=-1â as a descendants of ârole=textâ
Actual: Ensures ârole=textâ is used on elements with no focusable descendants
Motivation: I use âtabindex=-1â to let JavaScript set the focus to a descendant to make a copy to the clipboard. I use ârole=textâ to let VoiceOver (and others) read the content without destruction.
Simple example (fails):
<p>
some text
<span role="text">
more text
<span tabindex="-1">JavaScript is able to focus this</span>
</span>
</p>
Second example (fails):
<p>
some text
<span role="text">
more text
<span tabindex="-1" aria-hidden="true" class="visually-hidden">JavaScript is able to focus this</span>
</span>
</p>
axe-core version: 4.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Ensures role="text" is used on elements with no focusable ...
How to Fix the Problem. Correct markup solutions. The role="text" attribute should be put on an element with no focusable descendants.
Read more >role='text' should have no focusable descendants
No focusable children are allowed on elements with the role="text" attribute. When a text node is split by markup (for example, <h1>Good morning, ......
Read more >Element with presentational children has no focusable content ...
Description. This rule checks that elements with a role that makes its children presentational do not contain focusable elements.
Read more >Role=âtextâ is (presently) kinda not a thing, sorta. | Part of a ...
tabindex="0" does not belong on text elements. By themselves, text elements are not expected to receive keyboard focus from the tab key.
Read more >Axe: ARIA | webhint documentation
... Certain ARIA roles must contain particular children (aria-required-children) ... ârole=textâ should have no focusable descendants (aria-text)Â ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I must confess that I strayed from your advice @WilcoFiers - my PR uses âisFocusable(vNode)â rather than âvNode.isFocusableâ because the latter seemed to break ânested-interactive virtual-ruleâ. I donât know why. Anyway, I hope my PR helps.
Right on. Iâm working on it.