MCPcopy Index your code
hub / github.com/codeaashu/claude-code / handleKeyDown

Function handleKeyDown

web/components/a11y/FocusTrap.tsx:40–59  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

38 );
39
40 const handleKeyDown = (e: KeyboardEvent) => {
41 if (e.key !== "Tab") return;
42 const els = focusable();
43 if (els.length === 0) return;
44
45 const first = els[0];
46 const last = els[els.length - 1];
47
48 if (e.shiftKey) {
49 if (document.activeElement === first) {
50 e.preventDefault();
51 last.focus();
52 }
53 } else {
54 if (document.activeElement === last) {
55 e.preventDefault();
56 first.focus();
57 }
58 }
59 };
60
61 // Move focus into the trap on mount
62 const els = focusable();

Callers

nothing calls this directly

Calls 3

focusableFunction · 0.85
preventDefaultMethod · 0.80
focusMethod · 0.45

Tested by

no test coverage detected