MCPcopy
hub / github.com/codeaashu/claude-code / focus

Method focus

src/ink/focus.ts:27–42  ·  view source on GitHub ↗
(node: DOMElement)

Source from the content-addressed store, hash-verified

25 }
26
27 focus(node: DOMElement): void {
28 if (node === this.activeElement) return
29 if (!this.enabled) return
30
31 const previous = this.activeElement
32 if (previous) {
33 // Deduplicate before pushing to prevent unbounded growth from Tab cycling
34 const idx = this.focusStack.indexOf(previous)
35 if (idx !== -1) this.focusStack.splice(idx, 1)
36 this.focusStack.push(previous)
37 if (this.focusStack.length > MAX_FOCUS_STACK) this.focusStack.shift()
38 this.dispatchFocusEvent(previous, new FocusEvent('blur', node))
39 }
40 this.activeElement = node
41 this.dispatchFocusEvent(node, new FocusEvent('focus', previous))
42 }
43
44 blur(): void {
45 if (!this.activeElement) return

Callers 9

handleAutoFocusMethod · 0.95
handleClickFocusMethod · 0.95
moveFocusMethod · 0.95
SearchBarFunction · 0.45
handleKeyDownFunction · 0.45
FocusTrapFunction · 0.45
CommandPaletteFunction · 0.45
sendMethod · 0.45
useFocusReturnFunction · 0.45

Calls 3

spliceMethod · 0.80
shiftMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected