diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/TasksTopBar.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/TasksTopBar.tsx index 54914bd1413..df29900c384 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/TasksTopBar.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/components/TasksView/components/TasksTopBar/TasksTopBar.tsx @@ -1,6 +1,8 @@ import { Input } from "@superset/ui/input"; import { Tabs, TabsList, TabsTrigger } from "@superset/ui/tabs"; +import { useRef } from "react"; import { HiOutlineMagnifyingGlass } from "react-icons/hi2"; +import { useAppHotkey } from "renderer/stores/hotkeys"; import { ActiveIcon } from "../shared/icons/ActiveIcon"; import { AllIssuesIcon } from "../shared/icons/AllIssuesIcon"; import { BacklogIcon } from "../shared/icons/BacklogIcon"; @@ -43,6 +45,17 @@ export function TasksTopBar({ assigneeFilter, onAssigneeFilterChange, }: TasksTopBarProps) { + const searchInputRef = useRef(null); + + useAppHotkey( + "FOCUS_TASK_SEARCH", + () => { + searchInputRef.current?.focus(); + searchInputRef.current?.select(); + }, + { preventDefault: true }, + ); + return (
{/* Tabs and filters on the left */} @@ -80,10 +93,17 @@ export function TasksTopBar({
onSearchChange(e.target.value)} + onKeyDown={(e) => { + if (e.key === "Escape") { + onSearchChange(""); + searchInputRef.current?.blur(); + } + }} className="h-8 pl-9 pr-3 text-sm bg-muted/50 border-0 focus-visible:ring-1" />
diff --git a/apps/desktop/src/shared/hotkeys.ts b/apps/desktop/src/shared/hotkeys.ts index c9abbda8c0c..705aef00c1d 100644 --- a/apps/desktop/src/shared/hotkeys.ts +++ b/apps/desktop/src/shared/hotkeys.ts @@ -570,6 +570,12 @@ export const HOTKEYS = { category: "Workspace", description: "Quickly create a workspace in the current project", }), + FOCUS_TASK_SEARCH: defineHotkey({ + keys: "meta+f", + label: "Focus Task Search", + category: "Workspace", + description: "Focus the search input in the tasks view", + }), OPEN_PROJECT: defineHotkey({ keys: "meta+shift+o", label: "Open Project",