Skip to content

prefer-tag-over-role causing warnings on valid a11y patterns #920

Open
@geotrev

Description

@geotrev

I've been updating a few pieces of code after updating to include this rule, and I'm finding that certain usages are flagged possibly incorrectly?

For e.g., I have code like so that is used as a global page alert element:

<div role='status'>...</div>
<div role='alert'>...</div>

And gives the following output:

Use <output> instead of the ["status"/"alert"] role to ensure accessibility across all devices.

Another example for SVGs:

<svg role='img'>...</svg>

With similar warning:

Use <img> instead of the "img" role to ensure accessibility across all devices.

Which is strange because <output> is primarily used in forms, unlike alert and status containers which are often treated as live regions or focus trapped containers. (this isn't accurate)

I did some digging and both live regions and SVG images appear to be valid in these contexts.

Metadata

Metadata

Assignees

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