MCPcopy Create free account
hub / github.com/TanStack/devtools / isEditableTarget

Function isEditableTarget

packages/devtools/src/devtools.tsx:168–180  ·  view source on GitHub ↗
(element: Element | null)

Source from the content-addressed store, hash-verified

166 '--tsrd-font-size',
167 getComputedStyle(element).fontSize,
168 )
169 }
170 })
171 const isEditableTarget = (element: Element | null) => {
172 if (!element || !(element instanceof HTMLElement)) return false
173 if (element.isContentEditable) return true
174 if (['INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName)) return true
175 return element.getAttribute('role') === 'textbox'
176 }
177 // A memo owns what it creates, so changing the hotkey disposes the old
178 // shortcuts before registering the new ones.
179 createMemo(() => {
180 for (const permutation of getHotkeyPermutations(settings().openHotkey)) {
181 createShortcut(permutation, () => {
182 if (!hiddenInAutomation() && !isEditableTarget(document.activeElement))
183 toggleOpen()

Callers 1

DevToolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected