MCPcopy Index your code
hub / github.com/danvk/webdiff / isLegitKeypress

Function isLegitKeypress

ts/file_diff.ts:21–33  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

19
20// Useful for avoiding capturing keyboard shortcuts and text entry.
21export function isLegitKeypress(e: KeyboardEvent) {
22 const target = e.target as Element;
23 if (
24 e.ctrlKey ||
25 e.altKey ||
26 e.metaKey ||
27 target.tagName.toLowerCase() == 'input' ||
28 target.tagName.toLowerCase() == 'textarea'
29 ) {
30 return false;
31 }
32 return true;
33}

Callers 5

handleKeydownFunction · 0.90
handleKeydownFunction · 0.90
handleKeydownFunction · 0.90
ImageBlinkerFunction · 0.90
handleKeydownFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected