Skip to content

SelectableRegion should passthrough constraints to child unmodified#184083

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
Renzo-Olivares:selectableregion-web-size-fix
Mar 25, 2026
Merged

SelectableRegion should passthrough constraints to child unmodified#184083
auto-submit[bot] merged 1 commit into
flutter:masterfrom
Renzo-Olivares:selectableregion-web-size-fix

Conversation

@Renzo-Olivares

@Renzo-Olivares Renzo-Olivares commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #171632

Before this change the internal Stack that wraps a SelectableRegion to provide the native browser menu on the web through a platform view used the default StackFit.loose this means constraints passed to children are loosened. This caused the issue because it discarded incoming minimum layout constraints from the parent (setting them to zero). This prevented the child of SelectableRegion from expanding to fill their parent's bounds, allowing them to shrink to their intrinsic sizes instead.

After this change the internal Stack used by SelectableRegion now uses StackFit.passthrough to pass the constraints unmodified to its children. This fixes the issue by forwarding both minimum and maximum constraints unmodified, guaranteeing that child of SelectableRegion resolves to the same dimensions on the web and native.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Mar 24, 2026
@Renzo-Olivares Renzo-Olivares changed the title SelectableRegion should pass through constraints to child SelectableRegion should passthrough constraints to child unmodified Mar 24, 2026
@Renzo-Olivares Renzo-Olivares marked this pull request as ready for review March 24, 2026 19:57

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the PlatformSelectableRegionContextMenu by adding fit: StackFit.passthrough to its Stack widget. It also introduces new tests for SelectableRegion, including an update to an existing test to verify layout behavior and a new regression test for issue 171632 to ensure SelectableRegion preserves parent constraints. A review comment indicates that a const keyword is missing for a Text widget within a const Column in one of the new tests, which could lead to a compilation error and violates the 'Effective Dart: Style' guide.

Comment thread packages/flutter/test/widgets/selectable_region_test.dart
@Renzo-Olivares Renzo-Olivares added the CICD Run CI/CD label Mar 24, 2026
@navaronbracke navaronbracke added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 25, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Mar 25, 2026
Merged via the queue into flutter:master with commit ccb1b7c Mar 25, 2026
79 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 25, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 25, 2026
@loic-sharma

Copy link
Copy Markdown
Member

@navaronbracke Hey there, thanks for the super fast review. It's very much appreciated :)

Just a small request for future PRs: we generally prefer to let the authors merge their own work if they have the permissions, just to ensure they’ve done a final check and are ready for the code to go in. Also sometimes folks submit test pull requests to check for CI/CD failures but forget to mark it as a draft.

Thanks for understanding!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
…lutter#184083)

Fixes flutter#171632

Before this change the internal `Stack` that wraps a `SelectableRegion`
to provide the native browser menu on the web through a platform view
used the default `StackFit.loose` this means constraints passed to
children are loosened. This caused the issue because it discarded
incoming minimum layout constraints from the parent (setting them to
zero). This prevented the child of SelectableRegion from expanding to
fill their parent's bounds, allowing them to shrink to their intrinsic
sizes instead.

After this change the internal `Stack` used by `SelectableRegion` now
uses `StackFit.passthrough` to pass the constraints unmodified to its
children. This fixes the issue by forwarding both minimum and maximum
constraints unmodified, guaranteeing that child of `SelectableRegion`
resolves to the same dimensions on the web and native.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

Co-authored-by: Renzo Olivares <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 26, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Mar 26, 2026
…11372)

Manual roll Flutter from 82d96ef98a33 to e79bf6cbc140 (32 revisions)

Manual roll requested by [email protected]

flutter/flutter@82d96ef...e79bf6c

2026-03-26 [email protected] Roll Dart SDK from a3af8949863e to 7587a31814c6 (1 revision) (flutter/flutter#184213)
2026-03-26 [email protected] Adds rockchip series to block list for vulkan. (flutter/flutter#184207)
2026-03-26 [email protected] [ios]add ci/cd label to ios triage (flutter/flutter#184214)
2026-03-26 [email protected] Roll Skia from 10c97361d8f3 to bee5a06ef578 (1 revision) (flutter/flutter#184203)
2026-03-26 [email protected] Roll Fuchsia Linux SDK from rS5ezRgehkw26fKRX... to BIlBJNOlKjQeRFoFy... (flutter/flutter#184197)
2026-03-26 [email protected] Roll Packages from 5909bdd to 0dd2410 (3 revisions) (flutter/flutter#184198)
2026-03-26 [email protected] fix: use atomic write for engine.stamp to prevent race conditions (flutter/flutter#184131)
2026-03-26 [email protected] Roll Skia from 77dfb68002cd to 10c97361d8f3 (1 revision) (flutter/flutter#184195)
2026-03-26 [email protected] Roll Dart SDK from 349dbbbdba99 to a3af8949863e (1 revision) (flutter/flutter#184194)
2026-03-26 [email protected] Roll Skia from 81ef2238cb09 to 77dfb68002cd (12 revisions) (flutter/flutter#184186)
2026-03-26 [email protected] Revert "Keep glyphs for variable fonts (#183857)" (flutter/flutter#184147)
2026-03-26 [email protected] Expand simple shape path optimization logic and move it from dl_dispatcher to dl_builder (flutter/flutter#184096)
2026-03-26 [email protected] Fix merge changelog workflow. (flutter/flutter#184145)
2026-03-26 [email protected] Add notes on HCPP to `Android-Platform-Views.md` (flutter/flutter#183859)
2026-03-26 [email protected] Adds explicit name to the cicd label job. (flutter/flutter#184070)
2026-03-26 [email protected] Roll Dart SDK from 26f80b9403f5 to 349dbbbdba99 (3 revisions) (flutter/flutter#184176)
2026-03-26 [email protected] Collect impeller analytics for appbundles (flutter/flutter#184146)
2026-03-26 [email protected] [Dot shorthands] Migrate examples/api/lib/material (flutter/flutter#183963)
2026-03-26 [email protected] Roll Dart DevTools to a version with correct CIPD tags (flutter/flutter#184172)
2026-03-25 [email protected] Pipes ScrollCacheExtent through more scroll views (flutter/flutter#184078)
2026-03-25 [email protected] Add widget of the week link in SensitiveContent documentation (flutter/flutter#183972)
2026-03-25 [email protected] Roll Packages from 8dcfd11 to 5909bdd (13 revisions) (flutter/flutter#184123)
2026-03-25 [email protected] Roll Dart SDK from c48f0c954d86 to 26f80b9403f5 (1 revision) (flutter/flutter#184117)
2026-03-25 [email protected] Roll Skia from 51725ae49ef5 to 81ef2238cb09 (3 revisions) (flutter/flutter#184115)
2026-03-25 [email protected] Roll Fuchsia Linux SDK from M3sjWggTQmP2AD4bS... to rS5ezRgehkw26fKRX... (flutter/flutter#184114)
2026-03-25 [email protected] Add SensitiveContent widget sample code (flutter/flutter#183846)
2026-03-25 [email protected] SelectableRegion should passthrough constraints to child unmodified (flutter/flutter#184083)
2026-03-25 [email protected] Roll Dart SDK from ce171d5026ff to c48f0c954d86 (2 revisions) (flutter/flutter#184105)
2026-03-25 [email protected] Roll Skia from 789ad6b12776 to 51725ae49ef5 (3 revisions) (flutter/flutter#184106)
2026-03-25 [email protected] Roll Skia from f4e59f82dc69 to 789ad6b12776 (7 revisions) (flutter/flutter#184098)
2026-03-25 [email protected] Roll Dart SDK from b08bd0a3ee39 to ce171d5026ff (4 revisions) (flutter/flutter#184095)
2026-03-24 [email protected] [flutter_goldens] Remove dead check on null being in a list of non-nullables (flutter/flutter#183938)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

...
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Apr 14, 2026
…lutter#184083)

Fixes flutter#171632

Before this change the internal `Stack` that wraps a `SelectableRegion`
to provide the native browser menu on the web through a platform view
used the default `StackFit.loose` this means constraints passed to
children are loosened. This caused the issue because it discarded
incoming minimum layout constraints from the parent (setting them to
zero). This prevented the child of SelectableRegion from expanding to
fill their parent's bounds, allowing them to shrink to their intrinsic
sizes instead.

After this change the internal `Stack` used by `SelectableRegion` now
uses `StackFit.passthrough` to pass the constraints unmodified to its
children. This fixes the issue by forwarding both minimum and maximum
constraints unmodified, guaranteeing that child of `SelectableRegion`
resolves to the same dimensions on the web and native.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

Co-authored-by: Renzo Olivares <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SelectionArea width differs between web and native

3 participants