Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hungry-donkeys-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/devtools': patch
---

Ignore the hotkey while focus is in an editable element by guarding the createShortcut callback
11 changes: 11 additions & 0 deletions packages/devtools/src/devtools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,21 @@ export default function DevTools() {
}
})
createEffect(() => {
const isEditableTarget = (element: Element | null) => {
if (!element || !(element instanceof HTMLElement)) return false
if (element.isContentEditable) return true
const tagName = element.tagName
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT') {
return true
}
return element.getAttribute('role') === 'textbox'
}

const permutations = getHotkeyPermutations(settings().openHotkey)

for (const permutation of permutations) {
createShortcut(permutation, () => {
if (isEditableTarget(document.activeElement)) return
toggleOpen()
})
}
Expand Down