[Breaking Change] Proposed change in initial focus behavior for routes

Skip to first unread message

Greg Spencer

Sep 24, 2019, 11:07:52 AM9/24/19
to flutter-...@googlegroups.com

If you don't actively manage the focus routes, then this change is unlikely to affect you.

The proposed change will change focus handling when pushing and popping routes so that the FocusScopeNode for the route receives focus when pushed, and that the FocusScopeNode in the navigator receives focus when the route is popped.

This means that the last setFirstFocus call on the scope is used to determine which control actually receives focus. When the focus scope receives focus, it traverses its children, trying to find a non-scope node that is the "first focus" of itself or a child node.

This is a breaking change, because the focus behavior has changed. If you push a route after this change, and had a 'first focus' set on a widget via FocusScopeNode.setFirstFocus, it won't currently receive focus immediately, but after this change it will. Similarly, if you pop a route after this change, the focus will go back to where it was before the route was pushed, which is correct, but different from what happens now.

Please do not hesitate to reach out through commenting on the PR if you have any questions or concerns. Thanks!


Reply all
Reply to author
0 new messages