Skip to content

fix: stop corrupting the violations-by-node map in A11y - #1

Closed
zigzagdev wants to merge 2 commits into
mainfrom
fix/a11y-segment-violations-by-node
Closed

zigzagdev wants to merge 2 commits into
mainfrom
fix/a11y-segment-violations-by-node

Conversation

@zigzagdev

Copy link
Copy Markdown
Owner

Description

segmentViolationsByNode builds a map from DOM node target to its axe
violations. When a node already had an entry, it did:

map[node.target] = map[node.target].push(violation);

Array.prototype.push returns the new length (a number), not the array,
so this overwrote the array with a number. Once a node had 2 violations
recorded, map[target] became a number instead of an array. On a 3rd
violation for that same node, map[target].push(...) threw a
TypeError, crashing the dev-only A11y wrapper.

  • Fixed by pushing onto the existing array without reassigning it.

Also includes BUG_FINDINGS.md, a tracker of the bug/refactor findings
from a broader review of src/a11y .. src/button (the accordion and
badge fixes already merged in uber#5406 / uber#5408 are removed from it).

Scope

Patch: Bug Fix

…entries

Tracks the confirmed findings from the src/a11y..src/button review. The
accordion itemRefs/ArrowUp and badge LEFT_PLACEMENTS fixes already merged
to main, so their entries are removed here.
segmentViolationsByNode assigned Array.prototype.push's return value (the
new length, a number) back into the map instead of just pushing onto the
existing array. Once a DOM node had 2 violations, map[target] became a
number; a 3rd violation on that same node then called .push on a number
and threw a TypeError, crashing the dev-only A11y wrapper.
@zigzagdev

Copy link
Copy Markdown
Owner Author

Closing — opening the equivalent PR against uber/baseweb (upstream) instead.

@zigzagdev zigzagdev closed this Sep 5, 2026
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