Skip to content

Commit 56c2d87

Browse files
shivamhwpclaude
andcommitted
fix(web): keep "/" shortcut out of open dialogs
Bail when the keypress originates inside a dialog or popup so the shortcut cannot pull focus out of a modal focus trap. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 4d433bd commit 56c2d87

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎apps/web/src/components/settings/SettingsSidebarNav.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
9898
const target = event.target;
9999
if (
100100
target instanceof HTMLElement &&
101-
(target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)
101+
(target.tagName === "INPUT" ||
102+
target.tagName === "TEXTAREA" ||
103+
target.isContentEditable ||
104+
// Keep focus inside open dialogs and popups instead of escaping
105+
// their focus trap into the sidebar search.
106+
target.closest('[role="dialog"], [aria-modal="true"], [data-slot$="popup"]') !== null)
102107
) {
103108
return;
104109
}

0 commit comments

Comments
 (0)