Skip to content

fix: focus traversal into nested scrollable - #172283

Closed
Andro999b wants to merge 15 commits into
flutter:masterfrom
Andro999b:focus_traversal_scroll_scope
Closed

Andro999b wants to merge 15 commits into
flutter:masterfrom
Andro999b:focus_traversal_scroll_scope

Conversation

@Andro999b

@Andro999b Andro999b commented Jul 17, 2025 •

Copy link
Copy Markdown
  • Fix for Focus traversal into nested scrollable wrongly prevented #160431.
  • In DirectionalFocusTraversalPolicyMixin there is a check that prevents Scrollable from losing a focus by checking if focusable have same parent Scrollable. It works fine in most cases but mix of horizontal scrollable in vertical scrollable breaks focus traversal. To correct this behavior Axis check were added in this PR.

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. f: focus Focus traversal, gaining or losing focus labels Jul 17, 2025
@justinmc
justinmc requested a review from Piinks July 22, 2025 22:14

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

Hey @Andro999b! Welcome! Thanks for contributing!

variant: KeySimulatorTransitModeVariant.all(),
);

testWidgets(

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.

These tests all pass without the above change, which will not prevent us from regressing this in the future. Can you add a test that verifies that the expected behavior does not work without this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for pointing. I will revisit my tests.

@Piinks

Piinks commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

There may be a duplicate PR here: #172875

@Piinks

Piinks commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

Closing per #172875 (comment)

@Piinks Piinks closed this Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants