Skip to content

fix(baseline): match findings whose selector only moved (0.18.6) - #52

Merged
DuncanFaulkner merged 3 commits into
mainfrom
fix/baseline-stable-keys
Oct 25, 2026
Merged

DuncanFaulkner merged 3 commits into
mainfrom
fix/baseline-stable-keys

Conversation

@DuncanFaulkner

Copy link
Copy Markdown
Contributor

Fixes the baseline gate reporting a known finding as new when the markup around it was reordered.

Findings that don't match exactly get a second pass on a looser key. That key drops positional selector parts (:nth-child(3), :first-child and the like) outside :not(), :is(), :where() and :has(). It also drops the trailing counter of a generated id with at least two words before the number (#mat-input-3, #cdk-overlay-12, #pn_id_3). Ids like #h2, #col-12 and #item-2024 are compared as written. Both passes count duplicates, so a real extra instance still shows as added.

Trade-off, documented in the changelog: one instance fixed and another added in the same run, same rule and component, selectors differing only by position or id counter, pair as unchanged.

Version 0.18.6. 457 tests pass.

axe selectors can carry positional parts (li:nth-child(3)) and generated ids
(#mat-input-3). A markup reorder changed them, so a known finding came back as
new and failed the CI gate. diffAgainstBaseline now pairs by the exact key
first, then pairs what is left by a looser key with those parts removed, for
the same page, rule and owning component. Both passes count duplicates.
findingKey is unchanged.
Review: the id pattern merged #h2 with #h3 and #col-12 with #col-13, and
stripping inside :not() merged li:not(:first-child) with li:not(:last-child).
Both would hide a real new finding. Tests for each case.
…:has

Re-review: the lookbehind only protected a pseudo directly after :not(, so
li:not(.x:first-child) still merged with li:not(.x:last-child). Positions are
now stripped only outside selector functions. Tests for :not(.x:...), selector
lists and :has().
@DuncanFaulkner
DuncanFaulkner merged commit 58ed526 into main Oct 25, 2026
1 check passed
@DuncanFaulkner
DuncanFaulkner deleted the fix/baseline-stable-keys branch October 25, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant