Skip to content

Add custom message for negative tabindex in nested-interactive #3163

@WilcoFiers

Description

@WilcoFiers

See #3159

Even though they seem like they should, things like this just don't work well:

  <div role="button" id="pass7" tabindex="0">
    <button aria-hidden="true" tabindex="-1">hidden</button> text
  </div>
  <div role=checkbox aria-checked=true tabindex=0 aria-label=foo>
    <input type=checkbox aria-hidden=true tabindex=-1> <!-- visually hidden -->
  </div>

The button / input inside will still be packed up by various AT, that are trying very hard to ensure they don't miss things. This is by no means obvious, and so it would be good to add a specific message key to the no-focusable-content check that reports that using aria-hidden and negative tabindex is not a reliable way of hiding interactive elements. We should have a second message for role=none|presentation and negative tabindex too, just so we don't try to combine too many things.

See ariaErrormessageEvaluate for an example of how to use messageKey.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueFor first-time contributorsrule metadataIssues in the rule metadata code (lib/rules)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions