Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Keep held Cmd/Ctrl+L repeats from reaching the browser once the cite card is open

AdityaUmale66c1ad385ca9
diff --git a/src/components/CitationUI.tsx b/src/components/CitationUI.tsx
index 20748568a4..120fc47ebd 100644
--- a/src/components/CitationUI.tsx
+++ b/src/components/CitationUI.tsx
@@ -147,7 +147,12 @@ export function CitationSelectionToolbar({
viewportRef.current?.addEventListener("pointerup", update);
viewportRef.current?.addEventListener("keyup", update);
const focusAction = (event: KeyboardEvent) => {
- if (!captured || editing) return;
+ if (!captured) return;
+ if (editing) {
+ // Holding the shortcut keeps repeating it after the card opens; keep those repeats from reaching the browser.
+ if (event.repeat && isCitationShortcut(event, isMac)) event.preventDefault();
+ return;
+ }
if (isCitationShortcut(event, isMac)) {
if (captured.citation.quote.length > CITATION_MAX_QUOTE_LENGTH) return;
event.preventDefault();