fix(data-scrubbing): Stop source field suggestion scroll from crashing#116653
Merged
Conversation
The source field in the data scrubbing modal would throw `Cannot read properties of undefined (reading 'scrollIntoView')` and take down the whole modal via the error boundary. Two things stacked up. The rendered suggestion list is capped at 50 items, but arrow-key navigation bounded against the full (unsliced) length, so on a project with more than 50 suggestions you could move the active index past the last rendered node. The scroll then did `children[activeSuggestion]!.scrollIntoView()` and the `!` happily asserted away the undefined. Swap the index-into-children scroll for a callback ref on the active item that scrolls itself in, clamp arrow navigation to the rendered count, and optional-call scrollIntoView so it can never throw during commit. While in here, drop the dead selectorField/suggestionList refs, the no-op event.persist(), the unused handler arg, and the hideCaret state (a transparent-caret nicety that wasn't worth the surface area). Fixes JAVASCRIPT-39FH Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The dataset radios were in a horizontal Flex row. Switch to a column so each option sits on its own line. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.59% |
TkDodo
approved these changes
Jun 2, 2026
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.
The data scrubbing source field crashed with
Cannot read properties of undefined (reading 'scrollIntoView')because arrow-key nav bounded against the full suggestion list while only the first 50 are rendered, so the active index could point past a real DOM node.Scrolls via a callback ref on the active item instead of indexing into
children, clamps nav to the rendered count, and drops some dead weight in the component (unused refs,event.persist(), thehideCaretstate). Somewhat preparing this component to be rewritten as functional.fixes JAVASCRIPT-39FH
its this modal on the security and privacy page