Skip to content

fix(label-in-name): remove SC-failing inapplicable examples - #2443

Open
WilcoFiers wants to merge 2 commits into
developfrom
WilcoFiers-patch-1
Open

WilcoFiers wants to merge 2 commits into
developfrom
WilcoFiers-patch-1

Conversation

@WilcoFiers

@WilcoFiers WilcoFiers commented Aug 21, 2026

Copy link
Copy Markdown
Member

Removed inapplicable examples regarding abbreviations and non-standard terms from the document. These two may be inapplicable to the rule, but IMO they fail the success criterion. There is are no exceptions for abbreviations in this WCAG criterion. By having these as inapplicable examples we prohibit implementors from failing these.

Need for Call for Review: 1 week


How to Review And Approve

  • Go to the “Files changed” tab
  • Here you will have the option to leave comments on different lines.
  • Once the review is completed, find the “Review changes” button in the top right, select “Approve” (if you are really confident in the rule) or "Request changes" and click “Submit review”.
  • Make sure to also review the proposed Call for Review period. In case of disagreement, the longer period wins.

Removed inapplicable examples regarding abbreviations and non-standard terms from the document.
@netlify

netlify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploy Preview for act-rules ready!

Name Link
🔨 Latest commit 2e82777
🔍 Latest deploy log https://app.netlify.com/projects/act-rules/deploys/6aa80c5305f4780008b9d26e
😎 Deploy Preview https://deploy-preview-2443--act-rules.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@HelenBurge HelenBurge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is interesting as I know the use of ABBR is not supported by mobile screen readers, but agree this is not inapplicable.

kengdoj
kengdoj previously requested changes Sep 3, 2026

@kengdoj kengdoj left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are inapplicable for the rule, I added an explanation as to why they are not included on line 53.

Comment thread _rules/visible-label-in-accessible-name-2ee8b8.md
chutchins25 added a commit to dequelabs/axe-core that referenced this pull request Sep 10, 2026
…rd (#5345)

## Summary

Implements the comparison at the core of ACT rule 2ee8b8's [label in
name
algorithm](https://www.w3.org/WAI/standards-guidelines/act/rules/2ee8b8/proposed/#label-in-name-algorithm).
The check compared the accessible name and the visible label as raw
character substrings, so `Discover It` matched `Discover Italy`. Both
strings are now tokenized into words at non-text characters — replaced
with a space rather than deleted — and the label's words must form a
**contiguous run** within the name.

Supporting change: a backward-compatible `replaceWith` option on
`removeUnicode`, built from axe's explicit unicode ranges rather than a
`\p{…}` property escape, to keep Safari 7+ and IE11 working.

## Scope

Per @straker on #5203, abbreviation and hyphenation differences are an
**accepted divergence** from ACT:

> We are accepting that Inapplicable 5 & 6 will fail instead of
incomplete and should be skipped. See act-rules/act-rules.github.io#2443

So the check reports those as violations and the two testcases stay
skipped. There is no `incomplete` branch for punctuation.

Three algorithm steps remain unimplemented:

1. Parenthetical-content removal — tracked on #5207, which also covers
the `Passed Example 11` whitespace case
2. Unicode case folding + NFKD normalization — the CJK and full-width
half of this is tracked on #5308
3. Language-aware word segmentation (this splits on whitespace) — not
tracked

The `wcag-act-rules` dependency bump called out on #5203 is tracked as
#5346.

## ACT 2ee8b8 results

The `act` nightly installs `wcag-act-rules#main` (38 2ee8b8 testcases),
not the pinned dependency (15). Verified against `main`: **34 passing /
4 pending / 0 failing**.

| Skipped testcase | Reason |
| --- | --- |
| Inapplicable 5 — `University Ave.` | Accepted divergence
(abbreviation) |
| Inapplicable 6 — `non-standard` | Accepted divergence (hyphenation) |
| Passed 11 — `<span>Download</span><span>
</span><span>specification</span>` | #5207. `visibleVirtual` recurses
per child and `sanitize()`s each result, so a whitespace-only inline
element is trimmed to `''` and the words join into
`downloadspecification`. A `commons/text` fix, not a rule fix. |
| Passed 14 — `Search by date (YYYY-MM-DD)` | #5207. Needs the
parenthetical-removal step. |

`Failed Example 3` and `Failed Example 15` were previously skipped under
#5207 and are fixed by word-level matching, so their skips are removed.
I confirmed the two accepted-divergence skips are load-bearing:
unskipping them against `main` produces exactly two failures.

## Notes

Supersedes #5302, which was opened against #4311 before @straker closed
that as a duplicate of #5203. The tokenizer here is the part of #5302
that survived review; the punctuation `incomplete` branch it grew is
dropped per the ruling above.

The `publish-metadata.js` change from #5302 is not carried over — it is
out of scope for a rule PR, and the underlying defect is now tracked as
#5344.

Ref #5203
Co-authored-by: Kathy Eng <kengdoj@users.noreply.github.com>
@WilcoFiers
WilcoFiers dismissed kengdoj’s stale review September 14, 2026 15:01

Please check again

@WilcoFiers
WilcoFiers requested a review from kengdoj September 14, 2026 15:02
straker pushed a commit to dequelabs/axe-core that referenced this pull request Sep 14, 2026
## Summary

Implements step 1 of ACT 2ee8b8's [label in name
algorithm](https://www.w3.org/WAI/standards-guidelines/act/rules/2ee8b8/proposed/#label-in-name-algorithm)
— *"Remove parentheses … and all characters that are between a left and
right parenthesis"* — applied to both the visible label and the
accessible name before tokenising.

So `Search by date (YYYY-MM-DD)` now matches an accessible name of
`Search by date`, where previously the parenthesised suffix produced
extra tokens and failed the contiguous-subsequence check.

Nested pairs collapse by removing innermost pairs repeatedly; the loop
terminates because every pass strictly shortens the string.

## ACT 2ee8b8

Verified against `wcag-act-rules#main`, which is what the nightly
installs: **35 passing / 3 pending / 0 failing**, up from 34/3/1 —
`Passed Example 14` now passes and its `skipTests` entry is removed.
Pinned dependency stays at 14 passing / 1 pending.

Remaining skips are unchanged: `Inapplicable Example 5` and `6`
(accepted divergence, act-rules/act-rules.github.io#2443) and `Passed
Example 11`, which is not an algorithm problem — see below.

## Known gap

The algorithm names U+0028 and U+0029 specifically, so full-width
parentheses `()` used in CJK content are not removed. NFKD normalisation
would map them to their ASCII forms; that's step 2 of the algorithm,
tracked on #5308.

## Scope

This is step 1 only. #5207 also covers `Passed Example 11`, where
`visibleVirtual` recurses per child and `sanitize()`s each result,
trimming a whitespace-only inline element to `''` so `Download` and
`specification` join into one token. That fix lives in
`lib/commons/text/visible-virtual.js` and changes what "visible text"
means for every rule that reads it, so it needs a separate decision —
asked on #5207.

Refs #5207
@WilcoFiers WilcoFiers added the Review Call 1 week Call for review for small changes label Sep 15, 2026
@mraccess77

Copy link
Copy Markdown

Should they be moved to failure examples then?

straker pushed a commit to dequelabs/axe-core that referenced this pull request Sep 15, 2026
…every level (#5368)

## Summary

`visibleVirtual` ends every recursive call with `sanitize()`, which
trims. A
whitespace-only child therefore collapses to `''` before the parent
joins its
children, gluing together the words on either side:

```html
<a aria-label="Download specification"
  ><span>Download</span><span id="space"> </span><span>specification</span></a
>
```

produced `downloadspecification`, which no downstream tokenizing can
recover.

Per the decision on #5207 — keep using `visibleVirtual` rather than
writing a
rule-specific text function — nested calls now return their text as-is
and only
the outermost call sanitizes. The recursion passes an internal
`skipSanitize`
option, so the public signature and every existing call site are
unchanged.

## Effect

ACT `2ee8b8` against `wcag-act-rules#main`, which is what the nightly
installs:
**36 passing / 2 pending / 0 failing**, up from 35/3/0. `Passed Example
11`
passes with its `skipTests` entry removed; the two remaining pendings
are the
accepted abbreviation/hyphenation divergence
(act-rules/act-rules.github.io#2443). Against the pinned dependency: 14
passing
/ 1 pending, unchanged.

Whitespace at the edge of a child element is now also kept as a word
separator —
`<span>Hello </span><span>world</span>` returns `Hello world` where it
previously returned `Helloworld`. That is the same defect, and it is
what the
algorithm's "maintaining space between spans" requires.

## Testing

Three unit tests in `test/commons/text/visible-virtual.js`, each
confirmed red
before the change.

`visibleVirtual` feeds `color-contrast` (`noRecursing: true`,
unaffected),
`duplicate-img-label`, `form-control-value`, `aria.labelVirtual`,
`text.labelVirtual` and `label-content-name-mismatch`. Locally green:
every unit
suite, the 136-page selenium integration run, `test:node`, `test:jsdom`,
`test:locales`, `test:tsc` and `eslint`, with no existing test needing a
change.

Closes issue #5207
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review Call 1 week Call for review for small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants