Skip to content

New rule: Don't allow aria-hidden on focusable elements #881

@khiga8

Description

@khiga8

Hi team. I'd like to propose a rule that flags when aria-hidden="true' is set on focusable elements or on elements with descendants that are focusable. The rationale is that aria-hidden should be reserved for elements that are non-interactive since assistive technology users can still reach interactive elements in keyboard even with aria-hidden="true". Setting aria-hidden="true" on focusable elements can lead to unexpected behavior or be confusing.

An exception for this rule could be if a tabindex="-1" is set to remove it from keyboard order or if it's an input element with disabled. (While this could be an exception, I don't think this is necessarily a "good" approach since it's questionable whether interactive elements should be considered decorative, to begin with)

I would consider the following as focusable elements: textarea, button, a, input, summary.

What do you think? Am I missing anything?

I'm happy to start a draft PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions