MCPcopy Create free account
hub / github.com/TanStack/hotkeys / shouldIgnoreInputEvent

Function shouldIgnoreInputEvent

packages/hotkeys/src/manager.utils.ts:116–137  ·  view source on GitHub ↗
(
  event: KeyboardEvent,
  listenerTarget: HTMLElement | Document | Window,
  registrationTarget: HTMLElement | Document | Window,
)

Source from the content-addressed store, hash-verified

114 * - the event target as a final fallback
115 */
116export function shouldIgnoreInputEvent(
117 event: KeyboardEvent,
118 listenerTarget: HTMLElement | Document | Window,
119 registrationTarget: HTMLElement | Document | Window,
120): boolean {
121 const focused = getActiveElementForListenerTarget(listenerTarget)
122 if (focused && isInputElement(focused) && focused !== registrationTarget) {
123 return true
124 }
125
126 if (
127 event
128 .composedPath()
129 .some(
130 (element) => isInputElement(element) && element !== registrationTarget,
131 )
132 ) {
133 return true
134 }
135
136 return isInputElement(event.target) && event.target !== registrationTarget
137}
138
139/**
140 * Checks if an event is for the given target (originated from or bubbled to it).

Callers 2

#processTargetEventMethod · 0.90
#processTargetEventMethod · 0.90

Calls 2

isInputElementFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…