fix(ui-kit): don't hijack Cmd/Ctrl+B Bold in text fields (SidebarProvider) (#8305) - #8341
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 10:46:33 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Visual preview
Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy. Scroll preview
A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|


Summary
SidebarProvider's document-levelCmd/Ctrl+Bkeydown handler (packages/loopover-ui-kit/src/components/sidebar.tsx) toggled the sidebar and calledpreventDefault()regardless of what had focus — so typingCmd/Ctrl+Binside a text<input>,<textarea>, orcontenteditableelement hijacked the browser-native Bold shortcut and toggled the sidebar instead, anywhere aSidebarProvideris mounted.isTyping(event.target)guard tohandleKeyDownthat returns early — beforepreventDefault()/toggleSidebar()— when the target is a form field or contenteditable element. It mirrors the exact helper the repo's two other global keydown handlers already use (apps/loopover-ui/src/components/site/keyboard-shortcuts.tsx:80-84andapp-shell.tsx:129-131):tagName === "INPUT" | "TEXTAREA" | "SELECT"orisContentEditable.metaKey/ctrlKey+key === "b"condition is unchanged for the non-typing case;toggleSidebar, the cookie persistence, and everything else inSidebarProviderare untouched.Validation
packages/loopover-ui-kit/src/components/sidebar.test.tsx(none existed) — the regression test the deliverable asks for:Cmd/Ctrl+Bfromdocument.bodytoggles the sidebar and prevents the default;Cmd/Ctrl+Bfrom an<input>/<textarea>/ acontenteditableelement does not toggle and does notpreventDefault(); and an unrelatedCmd/Ctrlchord is left alone.@loopover/ui-kit: fullvitest run(22 tests) green,tsctypecheck green,prettier --checkclean,tscbuild green. (packages/loopover-ui-kitis intentionally out of the rootvitest.config.tscoverage.includeand not Codecov-gated, per the issue — this adds the regression test its own suite requires.)Closes #8305