Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

label-content-name-mismatch should not treat hyphenated labels as matching non-hyphenated content #4311

Open
dbjorge opened this issue Jan 26, 2024 · 0 comments
Labels

Comments

@dbjorge
Copy link
Contributor

dbjorge commented Jan 26, 2024

A recent ACT update added test case e9bbdbec137223e2973c6d2896050770c84c26e5 (Failure Example 4) to proposed ACT rule Visible label is part of accessible name (2ee8b8). axe-core currently passes this example where the updated ACT rule expects it to fail:

<a href="#" aria-label="non-standard">nonstandard</a>

This happens because axe-core is much more forgiving about punctuation than the ACT rule. The ACT rule's expectation wording is:

For each target element, all text nodes in the visible text content match characters and are contained within the accessible name of this target element, except for characters in the text nodes used to express non-text content. Leading and trailing whitespace and difference in case sensitivity should be ignored.

The critical difference is in the interpretation of the "except for characters in the text nodes used to express non-text content" clause. label-content-name-mismatch current removes all punctuation from both label and content before performing its comparison, presuming that punctuation always qualifies as "non-text content", but this isn't accurate in the case where punctuation creates a meaningful difference in language (eg, "government monitoring program" vs "government-monitoring program").

We do want to keep removing punctuation in some circumstances; for example, the 2.5.3 understanding doc's section on Punctation and capitalization clarifies that "First Name" is an acceptable label for a form field with visual content "First Name:", and that "Next" is an acceptable label for a button with visual content "Next...". Maybe we should strip punctuation only at the beginning and end of strings, instead of throughout?

This issue is linked to a skipTests entry in test/act-rules/visible-label-in-accessible-name-2ee8b8.spec.js.

@dbjorge dbjorge added fix Bug fixes ACT Rules labels Jan 26, 2024
dbjorge added a commit that referenced this issue Jan 26, 2024
Temporarily suppresses the ACT mismatch described by #4311 to avoid
nightly ACT test noise until we can fix the inconsistency

~Reviewer note: this suppression only has any effect if you're using ACT
content that we haven't yet picked up; you'll need to `npm install
w3c/wcag-act-rules#main` (like the nightly build does) to meaningfully
validate the change locally.~ As of 9a370b6, this can be tested without
updating to main

No QA required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant