fix: stop corrupting the violations-by-node map in A11y - #5410
Open
zigzagdev wants to merge 2 commits into
Open
Conversation
…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
requested review from
DianaSuvorova,
dyesin,
hualf1995 and
lijim
as code owners
September 5, 2026 06:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FixesDescription
segmentViolationsByNodebuilds a map from DOM node target to its axe violations.When a node already had an entry, it work:
Array.prototype.pushreturns 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 aTypeError, crashing the dev-onlyA11ywrapper.Scope
Patch: Bug Fix