From 82c7a3d32dbaaa97787020f710ef796d0fd396a1 Mon Sep 17 00:00:00 2001 From: Paulius Dervinis Date: Thu, 23 Jul 2026 13:53:11 +0300 Subject: [PATCH] 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 --- .../InputActionsEditorTests.cs | 21 +++++++++++++++++++ Packages/com.unity.inputsystem/CHANGELOG.md | 2 ++ .../UITKAssetEditor/Views/ActionMapsView.cs | 3 +++ 3 files changed, 26 insertions(+) diff --git a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs index 96a51f9a7a..04209a0ea7 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs @@ -189,6 +189,27 @@ public IEnumerator CanDeleteActionMap() Assert.That(m_Window.currentAssetInEditor.actionMaps[1].name, Is.EqualTo("Third Name")); } + [UnityTest] + public IEnumerator ActionMapsList_WhenMapDeletedViaKeyboard_ListRetainsFocus() + { + var actionMapsContainer = m_Window.rootVisualElement.Q("action-maps-container"); + var listView = m_Window.rootVisualElement.Q("action-maps-list-view"); + + // Select an action map and make sure the list holds keyboard focus before deleting. + var actionMapItem = actionMapsContainer.Query().ToList(); + SimulateClickOn(actionMapItem[1]); + yield return WaitForFocus(listView); + + SimulateDeleteCommand(); + + yield return WaitUntil(() => actionMapsContainer.Query().ToList().Count == 2, "wait for element to be deleted"); + + // After the post-delete rebuild destroys the previously focused row, focus must be + // returned to the list so keyboard shortcuts keep flowing without an extra click. + yield return WaitForFocus(listView); + Assert.That(listView.focusController.focusedElement, Is.EqualTo(listView)); + } + [UnityTest] public IEnumerator CanRenameAction() { diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index cb02afbecf..dee187e786 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] - yyyy-mm-dd +### Fixed +- 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) ## [1.20.0] - 2026-07-21 diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs index ae8537d19e..1f1a944de0 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs @@ -131,6 +131,9 @@ internal void RenameActionMap(int index) internal void DeleteActionMap(int index) { Dispatch(Commands.DeleteActionMap(index)); + + // Deleting an item sometimes causes the UI Panel to lose focus; make sure we keep it + m_ListView.Focus(); } internal void DuplicateActionMap(int index)