-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: Store ActionsTreeView current focus for restoring after RedrawUI #2043
base: develop
Are you sure you want to change the base?
Conversation
@@ -202,6 +202,9 @@ public override void DestroyView() | |||
|
|||
public override void RedrawUI(ViewState viewState) | |||
{ | |||
// Store the current focus before Clear/Rebuild | |||
Focusable focusedElement = m_ActionsTreeView.focusController.focusedElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not a good workaround because the focused element that is retrieved here might not be valid after the m_ActionsTreeView.Rebuild().
The Rebuild can create and/or recycle visualelement. https://docs.unity3d.com/6000.0/Documentation/ScriptReference/UIElements.BaseVerticalCollectionView.Rebuild.html
The focused element might also not represent the right sub visualelement since it's a stack of focused element.
RefreshItems() could mitigate the refres problem but the behavior is not predictable across version
https://docs.unity3d.com/6000.0/Documentation/ScriptReference/UIElements.BaseVerticalCollectionView.RefreshItems.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see now that it is not reliable since the test I added fails at random.
RefreshItems() doesn't work because the issue occurs in virtualizationController.Refresh() which is called by both. RefreshItems causes the issue intermittently instead, but also causes some other selection issues
@@ -17,6 +17,7 @@ however, it has to be formatted properly to pass verification tests. | |||
- Fixed pointerId staying the same when simultaneously releasing and then pressing in the same frame on mobile using touch. [ISXB-1006](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-845) | |||
- Fixed ISubmitHandler.OnSubmit event processing when operating in Manual Update mode (ISXB-1141) | |||
- Fixed Rename mode is not entered and name is autocompleted to default when creating a new Action Map on 2022.3. [ISXB-1151](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1151) | |||
- Fixed arrow key navigation of Input Actions after Action rename [ISXB-1024](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1024) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a missing point at the end of the sentence.
@@ -173,5 +189,55 @@ public IEnumerator CanDeleteActionMap() | |||
Assert.That(m_Window.currentAssetInEditor.actionMaps[0].name, Is.EqualTo("First Name")); | |||
Assert.That(m_Window.currentAssetInEditor.actionMaps[1].name, Is.EqualTo("Third Name")); | |||
} | |||
|
|||
[UnityTest] | |||
public IEnumerator CanRenameAction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great to see a test for this! There were a lot of cases on renaming and focus issues already.
de1aa47
to
aeedaec
Compare
Description
When calling ActionsTreeView.RedrawUI after renaming an Action the call to Rebuild clears any focus that the renamed element had. This saves the currently focused element and restores it back to the same focus if there was one.
Testing status & QA
Tested locally on 6000. Added new CanRenameAction test.
Overall Product Risks
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: