Skip to content

Possible false positive for label-title-only, caused by aria-describedby #3174

@fymmot

Description

@fymmot

Product

axe-core

Description:

I think I may have found a false positive bug for the label-title-only rule when using a combination of aria-labelledby, aria-describedby and aria-hidden on the labelling element.

Reproduced and explained here: https://codepen.io/fymmot/full/XWgQJLw

(My purpose for using aria-labelledby and aria-hidden in this way is to avoid duplicate announcements of the label texts for screen reader users. In our particular use case, we are using multiple elements to construct the label, which causes multiple swipes or down arrow interactions to move past it for the user.)

Expectation:

I expect that I can label an <input type="radio"> using aria-labelledby and having aria-hidden set on the labelling element.

I also expect that I can use aria-describedby on the same <input>, without it triggering a label-title-only error in aXe.

Actual:

When using a combination of aria-labelledby, aria-hidden and aria-describedby, aXe throws a label-title-only error.

I also get the same error if using hidden instead of aria-hidden.

I can remove the error by removing the aria-describedby attribute but keeping aria-labelledby.

I can also fix the error by removing aria-hidden or hidden from the labelling element.

Motivation:

This behavior does not seem logical, or intended. I don't think the presence of aria-describedby should affect the label-title-only test, as long as the aria-labelledby is valid.

If the combination of aria-labelledby and aria-hidden is discouraged or disallowed, it should throw an error regardless of aria-describedby, which it does not


axe-core version: 4.3.3
axe devtools extension (MacOS Chrome) version: 4.17.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixBug fixesrulesIssue or false result from an axe-core rule

    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