Skip to content

Commit 60e8a24

Browse files
committed
Store ActionsTreeView current focus for restoring after RedrawUI
1 parent 4e8347a commit 60e8a24

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ however, it has to be formatted properly to pass verification tests.
1717
- 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)
1818
- Fixed ISubmitHandler.OnSubmit event processing when operating in Manual Update mode (ISXB-1141)
1919
- 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)
20+
- Fixed arrow key navigation of Input Actions after Action rename [ISXB-1024](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1024)
2021

2122
### Changed
2223
- Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086)

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ public override void DestroyView()
202202

203203
public override void RedrawUI(ViewState viewState)
204204
{
205+
// Store the current focus before Clear/Rebuild
206+
Focusable focusedElement = m_ActionsTreeView.focusController.focusedElement;
207+
205208
m_ActionsTreeView.Clear();
206209
m_ActionsTreeView.SetRootItems(viewState.treeViewData);
207210
m_ActionsTreeView.Rebuild();
@@ -215,6 +218,12 @@ public override void RedrawUI(ViewState viewState)
215218

216219
// Don't want to show action properties if there's no actions.
217220
m_PropertiesScrollview.visible = m_ActionsTreeView.GetTreeCount() > 0;
221+
222+
// Rebuild causes the ActionsTreeView to lose focus; restore if there was focus before
223+
if (focusedElement != null)
224+
{
225+
focusedElement.Focus();
226+
}
218227
}
219228

220229
private void OnDraggedItem(DragPerformEvent evt)

0 commit comments

Comments
 (0)