Minimal reproduction for a bug where SelectionArea text selection breaks after
navigating between routes in a go_router ShellRoute.
When a SelectionArea wraps the child of a ShellRoute, navigating from a
parent route to a child route creates invisible "dead zones" where drag-to-select
silently fails. The dead zones correspond to the bounding boxes of selectable
text from the previous (now offstage) page.
- No crash, no assertion error, no console warnings
- The I-beam cursor still appears in the dead zone
- Only drag-to-select initiation fails; dragging INTO the zone from outside works
- The dead zone shifts when scrolling
flutter run -d chrome # debug (DDC) — reproduces
flutter run -d chrome --wasm # debug (WASM) — reproduces- Open the entities list screen (
/entities) - Verify text is selectable in the table (emails, names, phones)
- Click "View" on any entity to navigate to
/entities/:entityId - Try to select "First Name: John" by clicking and dragging -- fails
- Scroll down slightly -- the dead zone shifts, making different rows unselectable
- Hard-reload
/entities/entity-1directly (without navigating from list) -- works
| Command | Compiler | Bug reproduces? |
|---|---|---|
flutter run -d chrome |
DDC (debug) | Yes |
flutter run -d chrome --wasm |
dart2wasm (debug) | Yes |
flutter run -d chrome --release --wasm |
dart2wasm (release) | Yes |
flutter run -d chrome --release |
dart2js (release) | No |
When navigating to /entities/entity-1, go_router's route matching produces two
RouteMatch objects for the shell's Navigator: /entities (parent) and
:entityId (child). The Navigator keeps the parent page mounted but offstage.
SelectableRegion (behind SelectionArea) does not use the render tree's
hit-testing -- it iterates its own list of registered selectables. The offstage
page's Text widgets remain registered with valid bounding boxes that overlap the
current page's content, intercepting selection events.
main: Reproduces the bug with publishedgo_router: ^17.1.0fix/offstage-selection-disabler: Fix using a local go_router fork that wraps offstage page content inSelectionContainer.disabled
See INVESTIGATION.md for the full analysis.