refactor(screenreader-trap): replace recursive util functions#245
Merged
ianmcburnie merged 1 commit intomasterfrom Mar 31, 2026
Merged
refactor(screenreader-trap): replace recursive util functions#245ianmcburnie merged 1 commit intomasterfrom
ianmcburnie merged 1 commit intomasterfrom
Conversation
…erative loops Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
b368d39 to
092c407
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the DOM traversal helpers in makeup-screenreader-trap to use iterative loops instead of recursion, preventing potential stack overflows on very deep DOM trees while preserving existing behavior.
Changes:
- Replaced recursive sibling-walking utilities with iterative
whileloops (getPreviousSiblings,getNextSiblings). - Removed the
getAllAncestorshelper and inlined its logic intogetAncestorsusing an iterative loop. - Updated built
distoutputs and the docs bundle artifacts to reflect the source changes.
Reviewed changes
Copilot reviewed 1 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/makeup-screenreader-trap/src/util.js | Converts recursive DOM traversal helpers to iterative loops and inlines ancestor collection. |
| packages/core/makeup-screenreader-trap/dist/mjs/util.js | Updates ESM build output for the iterative traversal changes. |
| packages/core/makeup-screenreader-trap/dist/cjs/util.js | Updates CJS build output for the iterative traversal changes. |
| docs/core/makeup-screenreader-trap/index.min.js.map | Regenerated sourcemap artifact reflecting updated bundle contents. |
| docs/core/makeup-screenreader-trap/index.min.js | Regenerated docs bundle reflecting updated traversal implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Test plan