Skip to content

Commit 82c7a3d

Browse files
committed
FIX: Action Maps list loses keyboard focus after deleting a map [UUM-147152]
The Action Maps list in the UITK Input Actions editor lost keyboard focus after a map was deleted, so shortcuts stopped working until the user clicked a map again. ActionMapsView.DeleteActionMap(int index) dispatches the delete command that rebuilds the list and destroys the previously focused row, leaving the panel with no focused element. It now calls m_ListView.Focus() after the dispatch, restoring focus to the Action Maps list so Delete, Duplicate, and arrow-key navigation keep flowing to the auto-selected replacement map. This mirrors the existing behaviour in the sibling ActionsTreeView.DeleteItem. Jira: https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-147152
1 parent c0cd81a commit 82c7a3d

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,27 @@ public IEnumerator CanDeleteActionMap()
189189
Assert.That(m_Window.currentAssetInEditor.actionMaps[1].name, Is.EqualTo("Third Name"));
190190
}
191191

192+
[UnityTest]
193+
public IEnumerator ActionMapsList_WhenMapDeletedViaKeyboard_ListRetainsFocus()
194+
{
195+
var actionMapsContainer = m_Window.rootVisualElement.Q("action-maps-container");
196+
var listView = m_Window.rootVisualElement.Q<ListView>("action-maps-list-view");
197+
198+
// Select an action map and make sure the list holds keyboard focus before deleting.
199+
var actionMapItem = actionMapsContainer.Query<InputActionMapsTreeViewItem>().ToList();
200+
SimulateClickOn(actionMapItem[1]);
201+
yield return WaitForFocus(listView);
202+
203+
SimulateDeleteCommand();
204+
205+
yield return WaitUntil(() => actionMapsContainer.Query<InputActionMapsTreeViewItem>().ToList().Count == 2, "wait for element to be deleted");
206+
207+
// After the post-delete rebuild destroys the previously focused row, focus must be
208+
// returned to the list so keyboard shortcuts keep flowing without an extra click.
209+
yield return WaitForFocus(listView);
210+
Assert.That(listView.focusController.focusedElement, Is.EqualTo(listView));
211+
}
212+
192213
[UnityTest]
193214
public IEnumerator CanRenameAction()
194215
{

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased] - yyyy-mm-dd
99

10+
### Fixed
1011

12+
- Fixed the Action Maps list in the Input Actions editor losing keyboard focus after deleting a map, so that Delete, Duplicate, and arrow-key navigation kept working on the auto-selected replacement map without requiring an extra click [UUM-147152](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-147152)
1113

1214
## [1.20.0] - 2026-07-21
1315

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ internal void RenameActionMap(int index)
131131
internal void DeleteActionMap(int index)
132132
{
133133
Dispatch(Commands.DeleteActionMap(index));
134+
135+
// Deleting an item sometimes causes the UI Panel to lose focus; make sure we keep it
136+
m_ListView.Focus();
134137
}
135138

136139
internal void DuplicateActionMap(int index)

0 commit comments

Comments
 (0)