axe-core icon indicating copy to clipboard operation
axe-core copied to clipboard

empty-heading-matches should use getRole() to account for presentation conflict resolution

Open WilcoFiers opened this issue 3 years ago • 1 comments

The following should fail the empty-heading rule, it is instead considered inapplicable because of role=none. However, role=none is in practice ignored because of the use of aria-label. As a global attribute, aria-label tells browsers to ignore role=none. This can be solved by updating the rules/heading-matches.js, replacing its custom role computation with the aria.getRole() commons method, which already account for presentational role conflict resolution.

<h1 aria-label="" role="none"></h1>

WilcoFiers avatar May 31 '22 10:05 WilcoFiers

@WilcoFiers

aria.getRole() replaced the custom logic as part of PR #3582.

I introduced two new tests to cover this case there since it was changing anyway:

dbowling avatar Aug 05 '22 22:08 dbowling

Validated with the latest develop branch code base, seeing empty-heading failure on <h1 aria-label="" role="none"></h1> , when role=none. (using latest axe-core rule4.4.3) With the old rule set (4.3.5), not seeing any failure on empty-heading with the said snippet. image

padmavemulapati avatar Aug 29 '22 14:08 padmavemulapati