MCPcopy
hub / github.com/github/hotkey / isFormField

Function isFormField

src/utils.ts:4–22  ·  view source on GitHub ↗
(element: Node)

Source from the content-addressed store, hash-verified

2import {SEQUENCE_DELIMITER} from './sequence.js'
3
4export function isFormField(element: Node): boolean {
5 if (!(element instanceof HTMLElement)) {
6 return false
7 }
8
9 const name = element.nodeName.toLowerCase()
10 const type = (element.getAttribute('type') || '').toLowerCase()
11 return (
12 name === 'select' ||
13 name === 'textarea' ||
14 (name === 'input' &&
15 type !== 'submit' &&
16 type !== 'reset' &&
17 type !== 'checkbox' &&
18 type !== 'radio' &&
19 type !== 'file') ||
20 element.isContentEditable
21 )
22}
23
24export function fireDeterminedAction(el: HTMLElement, path: readonly NormalizedHotkeyString[]): void {
25 const delegateEvent = new CustomEvent('hotkey-fire', {cancelable: true, detail: {path}})

Callers 2

keyDownHandlerFunction · 0.85
fireDeterminedActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected