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

Method moveFocus

src/ink/focus.ts:110–131  ·  view source on GitHub ↗
(direction: 1 | -1, root: DOMElement)

Source from the content-addressed store, hash-verified

108 }
109
110 private moveFocus(direction: 1 | -1, root: DOMElement): void {
111 if (!this.enabled) return
112
113 const tabbable = collectTabbable(root)
114 if (tabbable.length === 0) return
115
116 const currentIndex = this.activeElement
117 ? tabbable.indexOf(this.activeElement)
118 : -1
119
120 const nextIndex =
121 currentIndex === -1
122 ? direction === 1
123 ? 0
124 : tabbable.length - 1
125 : (currentIndex + direction + tabbable.length) % tabbable.length
126
127 const next = tabbable[nextIndex]
128 if (next) {
129 this.focus(next)
130 }
131 }
132}
133
134function collectTabbable(root: DOMElement): DOMElement[] {

Callers 3

focusNextMethod · 0.95
focusPreviousMethod · 0.95
ScrollKeybindingHandlerFunction · 0.80

Calls 2

focusMethod · 0.95
collectTabbableFunction · 0.85

Tested by

no test coverage detected