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.

"role=text": no focusable descendants

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
dan-trippcommented, Sep 24, 2021

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.

2reactions
dan-trippcommented, Sep 18, 2021

Right on. I’m working on it.

Read more comments on GitHub >

github_iconTop 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 >

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