diff --git a/src/components/layout/ExplorerSidebar.tsx b/src/components/layout/ExplorerSidebar.tsx index 835a00b3..52a4792a 100644 --- a/src/components/layout/ExplorerSidebar.tsx +++ b/src/components/layout/ExplorerSidebar.tsx @@ -332,6 +332,21 @@ export const ExplorerSidebar = ({ sidebarWidth, startResize, onCollapse, sidebar return () => window.removeEventListener("tabularis:paste-import", handler); }, [activeConnectionId, activeCapabilities]); + // Focus the first visible "Filter tables…" input (flat / per-schema / per-db + // layouts) when the focus_table_filter shortcut fires. + useEffect(() => { + const handler = () => { + const input = sidebarBodyRef.current?.querySelector( + "[data-table-filter]", + ); + input?.focus(); + input?.select(); + }; + window.addEventListener("tabularis:focus-table-filter", handler); + return () => + window.removeEventListener("tabularis:focus-table-filter", handler); + }, []); + const handleTableClick = (tableName: string, schema?: string) => { setActiveTable(tableName, schema); }; @@ -1438,6 +1453,7 @@ export const ExplorerSidebar = ({ sidebarWidth, startResize, onCollapse, sidebar setTableFilter(e.target.value)} placeholder={t("sidebar.filterTables")} diff --git a/src/components/layout/sidebar/SidebarDatabaseItem.tsx b/src/components/layout/sidebar/SidebarDatabaseItem.tsx index ea7e9d1e..ccd9081a 100644 --- a/src/components/layout/sidebar/SidebarDatabaseItem.tsx +++ b/src/components/layout/sidebar/SidebarDatabaseItem.tsx @@ -265,6 +265,7 @@ export const SidebarDatabaseItem = ({ setTableFilter(e.target.value)} placeholder={t("sidebar.filterTables")} diff --git a/src/components/layout/sidebar/SidebarSchemaItem.tsx b/src/components/layout/sidebar/SidebarSchemaItem.tsx index bb1abd3c..69e44cbb 100644 --- a/src/components/layout/sidebar/SidebarSchemaItem.tsx +++ b/src/components/layout/sidebar/SidebarSchemaItem.tsx @@ -223,6 +223,7 @@ export const SidebarSchemaItem = ({ setTableFilter(e.target.value)} placeholder={t("sidebar.filterTables")} diff --git a/src/config/shortcuts.json b/src/config/shortcuts.json index 13f59f3b..0995e31c 100644 --- a/src/config/shortcuts.json +++ b/src/config/shortcuts.json @@ -99,6 +99,16 @@ "i18nKey": "settings.shortcuts.toggleSidebar", "overridable": true }, + { + "id": "focus_table_filter", + "category": "navigation", + "defaultMac": "⌘+Shift+F", + "defaultWin": "Ctrl+Shift+F", + "macMatch": { "metaKey": true, "shiftKey": true, "key": "f" }, + "winMatch": { "ctrlKey": true, "shiftKey": true, "key": "f" }, + "i18nKey": "settings.shortcuts.focusTableFilter", + "overridable": true + }, { "id": "open_connections", "category": "navigation", diff --git a/src/hooks/useGlobalShortcuts.ts b/src/hooks/useGlobalShortcuts.ts index ad216b66..e4d290e3 100644 --- a/src/hooks/useGlobalShortcuts.ts +++ b/src/hooks/useGlobalShortcuts.ts @@ -17,11 +17,13 @@ export function useGlobalShortcuts() { // Don't fire when typing in inputs / textareas / contenteditable (except for the quick navigator) const target = e.target as HTMLElement; const isQuickNavigator = matchesShortcut(e, "quick_navigator"); + const isFocusTableFilter = matchesShortcut(e, "focus_table_filter"); if ( (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable) && - !isQuickNavigator + !isQuickNavigator && + !isFocusTableFilter ) { return; } @@ -32,6 +34,12 @@ export function useGlobalShortcuts() { return; } + if (matchesShortcut(e, "focus_table_filter")) { + e.preventDefault(); + window.dispatchEvent(new CustomEvent("tabularis:focus-table-filter")); + return; + } + if (matchesShortcut(e, "paste_import_clipboard")) { e.preventDefault(); window.dispatchEvent(new CustomEvent("tabularis:paste-import")); diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 6bf12985..51447326 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -572,6 +572,7 @@ "tabSwitcher": "Tab wechseln", "copySelection": "Auswahl kopieren", "toggleSidebar": "Seitenleiste umschalten", + "focusTableFilter": "Tabellenfilter fokussieren", "openConnections": "Verbindungen öffnen", "newConnection": "Neue Verbindung", "newTab": "Neuer Tab", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 3f126659..c4b7258a 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -605,6 +605,7 @@ "tabSwitcher": "Switch tab", "copySelection": "Copy selection", "toggleSidebar": "Toggle sidebar", + "focusTableFilter": "Focus table filter", "openConnections": "Open connections", "newConnection": "New connection", "newTab": "New tab", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index d4f3aa41..c94ee32d 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -577,6 +577,7 @@ "tabSwitcher": "Cambiar pestaña", "copySelection": "Copiar selección", "toggleSidebar": "Mostrar/ocultar barra lateral", + "focusTableFilter": "Enfocar el filtro de tablas", "openConnections": "Abrir conexiones", "newConnection": "Nueva conexión", "newTab": "Nueva pestaña", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index eedf2cf2..9f5f0c3f 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -572,6 +572,7 @@ "tabSwitcher": "Changer d’onglet", "copySelection": "Copier la sélection", "toggleSidebar": "Afficher/masquer la barre latérale", + "focusTableFilter": "Focaliser le filtre de tables", "openConnections": "Ouvrir les connexions", "newConnection": "Nouvelle connexion", "newTab": "Nouvel onglet", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index 4bf32e0c..afa62335 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -577,6 +577,7 @@ "tabSwitcher": "Cambia tab", "copySelection": "Copia selezione", "toggleSidebar": "Mostra/nascondi sidebar", + "focusTableFilter": "Focalizza il filtro tabelle", "openConnections": "Apri connessioni", "newConnection": "Nuova connessione", "newTab": "Nuovo tab", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index e8f79120..38240998 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -586,6 +586,7 @@ "tabSwitcher": "タブを切り替え", "copySelection": "選択範囲をコピー", "toggleSidebar": "サイドバーを切り替え", + "focusTableFilter": "テーブルフィルターにフォーカス", "openConnections": "接続を開く", "newConnection": "新規接続", "newTab": "新規タブ", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index 7611649a..d419fe8e 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -567,6 +567,7 @@ "tabSwitcher": "Переключить вкладку", "copySelection": "Копировать выделение", "toggleSidebar": "Показать/скрыть боковую панель", + "focusTableFilter": "Фокус на фильтре таблиц", "openConnections": "Открыть подключения", "newConnection": "Новое подключение", "newTab": "Новая вкладка", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index 7dabdba7..0ee1f4c0 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -541,6 +541,7 @@ "tabSwitcher": "切换标签", "copySelection": "复制选区", "toggleSidebar": "切换侧边栏", + "focusTableFilter": "聚焦表格筛选", "openConnections": "打开连接", "newConnection": "新建连接", "newTab": "新建标签",