Repository navigation
Change Focus.unfocus to take a disposition for where the focus should go. - #50831
Merged
Merged
Conversation
gspencergoog
force-pushed
the
unfocus_disposition
branch
from
February 14, 2020 21:50
c286a36 to
83cb986
Compare
Contributor
Author
gspencergoog
force-pushed
the
unfocus_disposition
branch
from
February 14, 2020 22:47
83cb986 to
61be91b
Compare
goderbauer
reviewed
Feb 18, 2020
Member
|
Cirrus seems unhappy. |
gspencergoog
force-pushed
the
unfocus_disposition
branch
from
February 19, 2020 00:48
61be91b to
c22ac82
Compare
1 task done
gspencergoog
force-pushed
the
unfocus_disposition
branch
from
February 19, 2020 22:59
c22ac82 to
9f33a20
Compare
13 tasks
gspencergoog
force-pushed
the
unfocus_disposition
branch
3 times, most recently
from
February 20, 2020 23:51
e610b7d to
26a0baf
Compare
Contributor
Author
|
@goderbauer, OK Cirrus should be happy again. PTAL. |
gspencergoog
force-pushed
the
unfocus_disposition
branch
3 times, most recently
from
February 24, 2020 18:04
de7cbbd to
01bee7b
Compare
chunhtai
reviewed
Feb 24, 2020
goderbauer
reviewed
Feb 24, 2020
gspencergoog
force-pushed
the
unfocus_disposition
branch
3 times, most recently
from
February 25, 2020 22:25
bc414d8 to
44bfe73
Compare
chunhtai
reviewed
Feb 25, 2020
…st for that scope.
gspencergoog
force-pushed
the
unfocus_disposition
branch
from
February 26, 2020 01:04
44bfe73 to
4adf056
Compare
chunhtai
reviewed
Feb 26, 2020
gspencergoog
force-pushed
the
unfocus_disposition
branch
from
February 26, 2020 01:30
4adf056 to
01d5ebd
Compare
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
Focus.unfocusis called, the caller usually just thinks about wanting to remove focus from the node, but really,unfocusis a request to automatically pass the focus to another (hopefully useful) node.This PR removes the
focusPreviousflag fromunfocus, and replaces it with adispositionenum that indicates where the focus should go from here.The other value of the
UnfocusDispositionenum isUnfocusDisposition.scope.UnfocusDisposition.previouslyFocusedChildis closest to whatfocusPreviousused to do: focus the nearest enclosing scope and use itsfocusedChildfield to walk down the tree, finding the leaffocusedChild. This PR modifies it slightly so that it walks up to the nearest focusable enclosing scope before trying to focus the children. This change addresses #48903A new mode:
UnfocusDisposition.scopewill focus the nearest focusable enclosing scope of this node without trying to use theFocusScopeNode.focusedChildvalue to descend to the leaf focused child. This is useful as a default for both text field finalization and for what happens whencanRequestFocusis set to false. It allows the scope to stay focused so thatnextFocus/previousFocusstill work as expected, but removes the focus from primary focus.In addition to those changes,
unfocuscalled on aFocuScopethat wasn't the primary focus used to unfocus the primary focus instead. I removed that behavior, since it was buggy: if the primary focus was inside of a child scope, and you called unfocus on the parent scope, then the child scope could have focused another of its children instead, leaving the scope that you calledunfocuson withhasFocusreturning true still. If you want to remove the focus from the primary focus instead of the scope, that's easy enough to do: just callprimaryFocus.unfocus().Related Issues
Tests
Breaking Change
focusPreviousargument doesn't appear in any customer tests.