fix: prevent Ctrl+V in dialogs from pasting into editor#2018
fix: prevent Ctrl+V in dialogs from pasting into editor#2018bajrangCoder merged 1 commit intoAcode-Foundation:mainfrom
Conversation
Greptile SummaryThis PR replaces a narrow Confidence Score: 5/5Safe to merge — the change is a targeted, well-scoped guard with no regressions introduced. All remaining observations are P2 or lower. The helper correctly covers all interactive form controls and dialog containers, is well-documented, and the Element.closest() multi-selector is broadly supported. No logic errors or security issues found. No files require special attention.
|
| Filename | Overview |
|---|---|
| src/handlers/keyboard.js | Replaces single HTMLTextAreaElement guard with shouldIgnoreEditorShortcutTarget covering all form controls, contenteditable, and dialog containers (.prompt, #palette); logic is correct and well-documented. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[document keydown event] --> B{shouldIgnoreEditorShortcutTarget?}
B -- "HTMLInputElement\nHTMLTextAreaElement\nHTMLSelectElement\nisContentEditable\n.prompt / #palette ancestor" --> C[Track Escape key state\nreturn — do NOT forward to editor]
B -- false --> D{modifier key pressed?}
D -- no --> E[return — nothing to forward]
D -- yes --> F{target is editor contentDOM?}
F -- yes --> G[return — already handled by CodeMirror]
F -- no --> H[Re-dispatch KeyboardEvent\nto editor contentDOM]
Reviews (1): Last reviewed commit: "fix: prevent Ctrl+V in dialogs from past..." | Re-trigger Greptile
No description provided.