Make sure that a FocusScope doesn't crash in 0x0 environment#180715
Make sure that a FocusScope doesn't crash in 0x0 environment#180715auto-submit[bot] merged 1 commit intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a regression test for an issue where FocusScope would crash in a zero-sized environment. The new test case correctly sets up this scenario to prevent future regressions. My feedback focuses on improving the test's teardown logic to ensure better test isolation.
| tester.view.physicalSize = Size.zero; | ||
| final focusScopeNode = FocusScopeNode(); | ||
| addTearDown(tester.view.reset); | ||
| addTearDown(focusScopeNode.dispose); |
There was a problem hiding this comment.
To ensure test isolation, it's better to restore the original physicalSize of the view in a teardown block rather than calling tester.view.reset(). This prevents side effects on other tests that might rely on a default view size. The suggested change saves the original size and restores it after the test, ensuring a clean state for subsequent tests.
| tester.view.physicalSize = Size.zero; | |
| final focusScopeNode = FocusScopeNode(); | |
| addTearDown(tester.view.reset); | |
| addTearDown(focusScopeNode.dispose); | |
| final Size originalSize = tester.view.physicalSize; | |
| addTearDown(() => tester.view.physicalSize = originalSize); | |
| tester.view.physicalSize = Size.zero; | |
| final focusScopeNode = FocusScopeNode(); | |
| addTearDown(focusScopeNode.dispose); |
victorsanni
left a comment
There was a problem hiding this comment.
Does FocusScope have its own renderbox? I took a look at the source code and it just wraps its child in an InheritedNotifier + Semantics. cc @dkwingsmt
dkwingsmt
left a comment
There was a problem hiding this comment.
LGTM. I think it's fine. It's to guarantee that we don't make any significant changes that involve layout in the future.
…#180715) This is my attempt to handle flutter#6537 for the FocusScope widget.
Manual roll requested by [email protected] flutter/flutter@b45a73b...5a2067b 2026-01-13 [email protected] Roll Packages from e57e7f4 to eb9e1dc (6 revisions) (flutter/flutter#180907) 2026-01-13 [email protected] Make sure that a FocusScope doesn't crash in 0x0 environment (flutter/flutter#180715) 2026-01-13 [email protected] [ Tool ] Handle `DartDevelopmentServiceException` when launching web applications (flutter/flutter#180905) 2026-01-13 [email protected] Removes `RequiresApi 23` (flutter/flutter#180629) 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 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Manual roll requested by [email protected] flutter/flutter@b45a73b...48c2475 2026-01-13 [email protected] Make sure that a FocusScope doesn't crash in 0x0 environment (flutter/flutter#180715) 2026-01-13 [email protected] [ Tool ] Handle `DartDevelopmentServiceException` when launching web applications (flutter/flutter#180905) 2026-01-13 [email protected] Removes `RequiresApi 23` (flutter/flutter#180629) 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 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
) Manual roll requested by [email protected] flutter/flutter@b45a73b...5a2067b 2026-01-13 [email protected] Roll Packages from e57e7f4 to eb9e1dc (6 revisions) (flutter/flutter#180907) 2026-01-13 [email protected] Make sure that a FocusScope doesn't crash in 0x0 environment (flutter/flutter#180715) 2026-01-13 [email protected] [ Tool ] Handle `DartDevelopmentServiceException` when launching web applications (flutter/flutter#180905) 2026-01-13 [email protected] Removes `RequiresApi 23` (flutter/flutter#180629) 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 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
) Manual roll requested by [email protected] flutter/flutter@b45a73b...48c2475 2026-01-13 [email protected] Make sure that a FocusScope doesn't crash in 0x0 environment (flutter/flutter#180715) 2026-01-13 [email protected] [ Tool ] Handle `DartDevelopmentServiceException` when launching web applications (flutter/flutter#180905) 2026-01-13 [email protected] Removes `RequiresApi 23` (flutter/flutter#180629) 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 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This is my attempt to handle #6537 for the FocusScope widget.