Skip to content

rules to warn on redundant roles #101

Closed
@sarbbottam

Description

@sarbbottam

role is probably the most misused aria attribute, for example #88, #91.

Adding role=button to a div does not make it a button.
One has to script the behavior, i.e. if enter/space was pressed invoke the click handler.
Also add tabindex=0 to make it focusable.

However if one had used <button> attaching a click handler would be sufficient.

<button> is focusable/tabable by default (no need of tabindex=0), and it triggers a click event when enter/space is pressed (no need for extra keypress event listeners).

Same for link, checkbox, radio, radiogroup, textbox and the proposed password roles. There are already corresponding HTML alternatives available, and one should use them instead of just adding roles.

I guess It is better to call out (error, warn) in such situation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions