Skip to content

"role=text": no focusable descendants #2934

Closed
@tujoworker

Description

@tujoworker

I really love that "role=text" made it in to axe-core. So I would like to thank everyone involved at first 🙏

PR: #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixBug fixesprA pr has been created for the issuerulesIssue or false result from an axe-core rule

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions