fix(tabs): Escape from a flat-rail web-tab menu returns focus to the row (#582 merge-time fix)

#582 made the web-tab actions menu reachable on the flat rail (ContextMenu or
Shift+F10 on a role=tab row), but closeTabGroupMenu only looked for a tree
item or a Focus shortcut, so Escape dropped focus to <body>. A `.session-tab`
trigger now counts too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-10-13 18:15:21 +02:00
1 parent 5d31e42db0
commit 34b867025d
1 file changed
+3 -2
+3 -2
View File
@@ -8161,10 +8161,11 @@ class CodemanApp {
menu.remove();
if (!restoreFocus) return;
// The trigger may have been re-rendered while the menu was open; find the
// live tree item by identity.
// live tree item by identity. A flat-rail row (a web tab's menu opens there
// too, from ContextMenu or Shift+F10) is a `.session-tab` with role=tab.
const rail = this.$('sessionTabs');
const item =
(trigger?.isConnected && (trigger.closest('[role="treeitem"]') || trigger.closest('.tab-focus-item'))) ||
(trigger?.isConnected && trigger.closest('[role="treeitem"], .tab-focus-item, .session-tab')) ||
[...(rail?.querySelectorAll('[role="treeitem"]') || [])].find((el) => this._tabTreeIdentity(el) === identity);
item?.focus();
}