Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
fix: handle keydown events with undefined key property
Khuram Niaz58068f9756c7
diff --git a/__tests__/SidebarContext.spec.tsx b/__tests__/SidebarContext.spec.tsxindex 08143c7..f744897 100644--- a/__tests__/SidebarContext.spec.tsx+++ b/__tests__/SidebarContext.spec.tsx@@ -105,6 +105,18 @@ describe("SidebarContext", () => {expect(screen.getByText("expanded")).toBeInTheDocument();});+ // Autofill/extension-dispatched keydown events can omit `key` entirely.+ it("ignores a keydown event with no key property", () => {+ renderHook(() => useSidebar(), {+ wrapper: makeWrapper(true),+ });++ const event = new KeyboardEvent("keydown", { metaKey: true });+ Object.defineProperty(event, "key", { value: undefined });++ expect(() => window.dispatchEvent(event)).not.toThrow();+ });+it("throws when used outside the provider", () => {const consoleError = vi.spyOn(console, "error")diff --git a/src/context/SidebarContext.tsx b/src/context/SidebarContext.tsxindex 14208d4..c35876b 100644--- a/src/context/SidebarContext.tsx+++ b/src/context/SidebarContext.tsx@@ -32,7 +32,7 @@ export function SidebarProvider({useEffect(() => {const onKeyDown = (e: KeyboardEvent) => {- if (e.key.toLowerCase() !== "b" || (!e.metaKey && !e.ctrlKey)) return;+ if (e.key?.toLowerCase() !== "b" || (!e.metaKey && !e.ctrlKey)) return;// Let editable elements (inputs, Tiptap/ProseMirror) keep Cmd/Ctrl+B// for their own shortcuts (e.g. bold) instead of toggling the sidebar.