(element: EventTarget | null)
| 46 | * Mod+S and Escape fire when the user has tabbed to a form button. |
| 47 | */ |
| 48 | export function isInputElement(element: EventTarget | null): boolean { |
| 49 | if (!element) { |
| 50 | return false |
| 51 | } |
| 52 | |
| 53 | if (element instanceof HTMLInputElement) { |
| 54 | const type = element.type.toLowerCase() |
| 55 | if (type === 'button' || type === 'submit' || type === 'reset') { |
| 56 | return false |
| 57 | } |
| 58 | return true |
| 59 | } |
| 60 | |
| 61 | if ( |
| 62 | element instanceof HTMLTextAreaElement || |
| 63 | element instanceof HTMLSelectElement |
| 64 | ) { |
| 65 | return true |
| 66 | } |
| 67 | |
| 68 | // Check for contenteditable elements (includes "true", "", "plaintext-only", |
| 69 | // and inherited contenteditable from ancestor elements) |
| 70 | if (element instanceof HTMLElement && element.isContentEditable) { |
| 71 | return true |
| 72 | } |
| 73 | |
| 74 | return false |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns the focused element for the document associated with where hotkey |
no outgoing calls
no test coverage detected
searching dependent graphs…