Skip to content

Expose skipTraversal in FocusableActionDetector - #191308

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
ishaquehassan:fix/187093-focusableactiondetector-skiptraversal
Sep 3, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
ishaquehassan:fix/187093-focusableactiondetector-skiptraversal

Conversation

@ishaquehassan

Copy link
Copy Markdown
Contributor

FocusableActionDetector wraps a Focus widget internally and forwards focusNode, autofocus, descendantsAreFocusable, and descendantsAreTraversable, but not skipTraversal. That leaves no way to keep a FocusableActionDetector in the focus chain for key events while excluding it from focus traversal, even though the inner Focus already supports exactly that.

This adds a skipTraversal parameter to FocusableActionDetector and passes it straight through to the inner Focus. It is typed bool? to match Focus.skipTraversal, so the default of null keeps the current behavior and Focus still resolves it to false unless a focus node overrides it. The skipTraversal documentation on Focus is pulled into a {@template flutter.widgets.Focus.skipTraversal} block so FocusableActionDetector can reuse it with {@macro}, the same convention already used for descendantsAreFocusable and descendantsAreTraversable.

This revives #187356, which picked up an LGTM before it was auto closed after 21 days without a reply. That earlier PR also bundled some unrelated private named parameter changes that drew review comments, so this version is trimmed down to just the skipTraversal forwarding plus its test.

Fixes #187093

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@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 introduces the skipTraversal property to FocusableActionDetector and forwards it to the inner Focus widget, with corresponding test coverage and documentation updates. The review feedback recommends adding skipTraversal to debugFillProperties in FocusableActionDetector to make it inspectable in the diagnostics tree.

final bool descendantsAreTraversable;

/// {@macro flutter.widgets.Focus.skipTraversal}
final bool? skipTraversal;

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.

medium

Consider adding skipTraversal to debugFillProperties in FocusableActionDetector so that it is inspectable in the diagnostics tree and DevTools.

Example:

properties.add(DiagnosticsProperty<bool>('skipTraversal', skipTraversal, defaultValue: null));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Had a look at this one. FocusableActionDetector doesn't define debugFillProperties at all, so there's no existing override to add this to. The only two in actions.dart are on Actions and _OverridableActionMixin.

Adding one here just for skipTraversal would leave the other 13 properties on the widget out of diagnostics, which felt worse than leaving it alone, and it's a bit outside what this PR is doing. Happy to send a separate PR that fills it in properly for the whole widget if that's useful.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: focus Focus traversal, gaining or losing focus labels Aug 18, 2026
victorsanni
victorsanni previously approved these changes Aug 27, 2026

@Renzo-Olivares Renzo-Olivares 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.

Hi @ishaquehassan, thank you for the contribution. I had one comment about the testing but other wise LGTM.

expect(buttonNode2.hasFocus, isFalse);
});

testWidgets('FocusableActionDetector forwards skipTraversal to Focus', (

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.

Consider adding to this test, or creating a new test that verifies that that the traversal focus skip behavior works with FocusableActionDetector.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a behavior test for this. It focuses the node before the detector, calls nextFocus, and checks focus lands on the node after it instead of on the detector, plus that the detector can still be focused explicitly.

Sanity checked it by dropping the skipTraversal forwarding out of actions.dart, and the traversal assertion fails without it, so the test is actually covering the change.

FocusableActionDetector wraps a Focus internally and forwards focusNode,
autofocus, descendantsAreFocusable, and descendantsAreTraversable, but
not skipTraversal, so there was no way to keep it in the focus chain for
key events while excluding it from traversal.

Add a bool? skipTraversal parameter that passes straight through to the
inner Focus. The null default preserves current behavior. The Focus
skipTraversal doc is pulled into a shared {@template} block and reused
on FocusableActionDetector via {@macro}, matching the existing
descendantsAreFocusable and descendantsAreTraversable convention.

Adds a widget test covering the default and forwarded values.

Fixes flutter#187093
The existing test only checked that the value reaches the inner Focus, which
verifies the plumbing rather than the behavior anyone relies on. This adds a
test that actually traverses: with skipTraversal set, nextFocus moves straight
past the detector to the following node, and the detector can still be focused
explicitly, which is the distinction between skipTraversal and canRequestFocus.

Confirmed the test is not vacuous by removing the forwarding line in
actions.dart and watching it fail on the traversal assertion.
@ishaquehassan
ishaquehassan force-pushed the fix/187093-focusableactiondetector-skiptraversal branch from a01d211 to c5563b7 Compare August 28, 2026 14:28

@Renzo-Olivares Renzo-Olivares 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.

LGTM

@Renzo-Olivares Renzo-Olivares added the CICD Run CI/CD label Sep 1, 2026

@victorsanni victorsanni 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.

LGTM!

auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 4, 2026
…12760)

Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions)

Manual roll requested by [email protected]

flutter/flutter@70797e1...5a6cfa7

2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767)
2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306)
2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443)
2026-09-04 [email protected] [AGP 9.1.0 Migration #5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116)
2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802)
2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294)
2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292)
2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283)
2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276)
2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275)
2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062)
2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269)
2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760)
2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263)
2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098)
2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146)
2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244)
2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514)
2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655)
2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764)
2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124)
2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240)
2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202)
2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136)
2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587)
2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838)
2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236)
2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185)
2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746)
2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235)
2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150)
2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228)
2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225)
2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219)
2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217)
2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139)
2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215)
2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212)
2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209)
2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308)
2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196)
2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130)
2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544)
2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193)
...
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…lutter#12760)

Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions)

Manual roll requested by [email protected]

flutter/flutter@70797e1...5a6cfa7

2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767)
2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306)
2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443)
2026-09-04 [email protected] [AGP 9.1.0 Migration flutter#5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116)
2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802)
2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294)
2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292)
2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283)
2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276)
2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275)
2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062)
2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269)
2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760)
2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263)
2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098)
2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146)
2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244)
2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514)
2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655)
2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764)
2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124)
2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240)
2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202)
2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136)
2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587)
2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838)
2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236)
2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185)
2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746)
2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235)
2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150)
2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228)
2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225)
2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219)
2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217)
2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139)
2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215)
2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212)
2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209)
2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308)
2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196)
2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130)
2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544)
2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193)
...
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…lutter#12760)

Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions)

Manual roll requested by [email protected]

flutter/flutter@70797e1...5a6cfa7

2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767)
2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306)
2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443)
2026-09-04 [email protected] [AGP 9.1.0 Migration flutter#5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116)
2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802)
2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294)
2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292)
2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283)
2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276)
2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275)
2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062)
2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269)
2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760)
2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263)
2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098)
2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146)
2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244)
2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514)
2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655)
2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764)
2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124)
2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240)
2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202)
2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136)
2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587)
2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838)
2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236)
2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185)
2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746)
2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235)
2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150)
2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228)
2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225)
2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219)
2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217)
2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139)
2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215)
2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212)
2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209)
2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308)
2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196)
2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130)
2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544)
2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD f: focus Focus traversal, gaining or losing focus framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FocusableActionDetector should expose skipTraversal from Focus

3 participants