Repository navigation
Conversation
Member
|
fly-by comment: the analyzer is unhappy. |
| while (scope != null && !scope.canRequestFocus) { | ||
| // This scope is not focusable, we should clears its previously | ||
| // focused children and move up the tree. | ||
| scope._focusedChildren.clear(); |
Contributor
There was a problem hiding this comment.
Why does it need to clear the children?
1 task done
Contributor
|
@chunhtai, Thanks for putting this together. I think #50831 includes the fixes that you have in this PR. The only thing I'm not doing is clearing the focused children as I go up the tree in So, I'm going to close this if that's OK. Let me know if I'm missing something. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When sets canrequestfocuse= false on a focusScopeNode that is currently focusing one of its child, the focus manager will call unfocus on the current focused child and refocus previous focused child in the tree. However, the search only go one level up in the focus tree. If it cannot find a node to focus in this level, it exit silently and refocus the root focus node.
I updated the logic so that it will search up the tree until it reach the root.
Related Issues
#48903 (comment)
Tests
I added the following tests:
"focus traverse correct when pop mutiple page simultaneously - with focused children"
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.