Repository navigation
Fix selection registration for hidden overlay entries - #189713
Draft
mvincentong wants to merge 3 commits into
Draft
mvincentong wants to merge 3 commits into
mvincentong wants to merge 3 commits into
Conversation
mvincentong
force-pushed
the
fix-selectable-region-background-routes
branch
from
August 1, 2026 12:38
99ff3f2 to
9c901c7
Compare
Contributor
Author
|
Tightened the fix in |
Contributor
Author
|
Also verified the regression in the package-relative Chrome harness: |
Contributor
|
Hey @mvincentong! Is this still something you want to work on? Draft PRs are not typically reviewed, you can mark it ready for review when it is. Thanks! |
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.
OverlayEntrys that remain mounted behind an opaque entry still build theirsubtrees to preserve state, but
_RenderTheaterskips their layout and paint.Those hidden subtrees were still inheriting the ancestor selection registrar,
so their selectables could be registered and compared before they had been laid
out. That could trigger the
RenderParagraph.debugNeedsLayoutassertion whileselection ordering was flushed.
This wraps only hidden maintained entries in
SelectionContainer.disabledwhenan ancestor selection registrar is present. Onstage entries continue to inherit
the existing registrar, and the route subtree remains mounted throughout so
its state is preserved. The public selection registrar API is unchanged.
Fixes #119772.
Tests:
./bin/flutter test --no-pub packages/flutter/test/widgets/selectable_region_test.dart../../bin/flutter test --no-pub --platform chrome test/widgets/selectable_region_test.dart --plain-name "ignores selection content in background Navigator pages"(frompackages/flutter)./bin/flutter test --no-pub packages/flutter/test/widgets/selection_container_test.dart packages/flutter/test/widgets/overlay_test.dart./bin/flutter analyze --no-pub packages/flutter/lib/src/widgets/overlay.dart packages/flutter/lib/src/widgets/selection_container.dart packages/flutter/test/widgets/selectable_region_test.dart./bin/dart format --output=none --set-exit-if-changed packages/flutter/lib/src/widgets/overlay.dart packages/flutter/lib/src/widgets/selection_container.dart packages/flutter/test/widgets/selectable_region_test.dartgit diff --checkRisk:
SelectionContainer.disabledbehavior is used to exclude hidden overlay entries from selection while preserving their mounted subtree. No public API is changed.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The Flutter team can override the code freeze workflow. See pinned issues for current guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find comments useful, you may update the code accordingly, but if you are unsure or disagree, wait for a Flutter team member's review.