fix: remove Cmd+1..9 company-switch shortcut
This shortcut interfered with browser tab-switching (Cmd+1..9) and produced a black screen when used. Removes the handler, the Layout callback, and the design-guide documentation entry. Closes RUS-56
This commit is contained in:
@@ -104,23 +104,12 @@ export function Layout() {
|
||||
|
||||
const togglePanel = togglePanelVisible;
|
||||
|
||||
// Cmd+1..9 to switch companies
|
||||
const switchCompany = useCallback(
|
||||
(index: number) => {
|
||||
if (index < companies.length) {
|
||||
setSelectedCompanyId(companies[index]!.id);
|
||||
}
|
||||
},
|
||||
[companies, setSelectedCompanyId],
|
||||
);
|
||||
|
||||
useCompanyPageMemory();
|
||||
|
||||
useKeyboardShortcuts({
|
||||
onNewIssue: () => openNewIssue(),
|
||||
onToggleSidebar: toggleSidebar,
|
||||
onTogglePanel: togglePanel,
|
||||
onSwitchCompany: switchCompany,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -4,10 +4,9 @@ interface ShortcutHandlers {
|
||||
onNewIssue?: () => void;
|
||||
onToggleSidebar?: () => void;
|
||||
onTogglePanel?: () => void;
|
||||
onSwitchCompany?: (index: number) => void;
|
||||
}
|
||||
|
||||
export function useKeyboardShortcuts({ onNewIssue, onToggleSidebar, onTogglePanel, onSwitchCompany }: ShortcutHandlers) {
|
||||
export function useKeyboardShortcuts({ onNewIssue, onToggleSidebar, onTogglePanel }: ShortcutHandlers) {
|
||||
useEffect(() => {
|
||||
function handleKeyDown(e: KeyboardEvent) {
|
||||
// Don't fire shortcuts when typing in inputs
|
||||
@@ -16,13 +15,6 @@ export function useKeyboardShortcuts({ onNewIssue, onToggleSidebar, onTogglePane
|
||||
return;
|
||||
}
|
||||
|
||||
// Cmd+1..9 → Switch company
|
||||
if ((e.metaKey || e.ctrlKey) && e.key >= "1" && e.key <= "9") {
|
||||
e.preventDefault();
|
||||
onSwitchCompany?.(parseInt(e.key, 10) - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
// C → New Issue
|
||||
if (e.key === "c" && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
||||
e.preventDefault();
|
||||
@@ -44,5 +36,5 @@ export function useKeyboardShortcuts({ onNewIssue, onToggleSidebar, onTogglePane
|
||||
|
||||
document.addEventListener("keydown", handleKeyDown);
|
||||
return () => document.removeEventListener("keydown", handleKeyDown);
|
||||
}, [onNewIssue, onToggleSidebar, onTogglePanel, onSwitchCompany]);
|
||||
}, [onNewIssue, onToggleSidebar, onTogglePanel]);
|
||||
}
|
||||
|
||||
@@ -1313,7 +1313,7 @@ export function DesignGuide() {
|
||||
["C", "New Issue (outside inputs)"],
|
||||
["[", "Toggle Sidebar"],
|
||||
["]", "Toggle Properties Panel"],
|
||||
["Cmd+1..9 / Ctrl+1..9", "Switch Company (by rail order)"],
|
||||
|
||||
["Cmd+Enter / Ctrl+Enter", "Submit markdown comment"],
|
||||
].map(([key, desc]) => (
|
||||
<div key={key} className="flex items-center justify-between px-4 py-2">
|
||||
|
||||
Reference in New Issue
Block a user