fix(app): R1 Escape layers with the page focused, twin keyboard framing, « Plus » field guard
This commit is contained in:
1 parent
90a5e7aa35
commit
132756eecd
7 files changed
+130
-8
No files matched your search
@@ -102,14 +102,27 @@ export function useRowFocus(focus: FocusRequest | undefined): void {
|
||||
)
|
||||
}
|
||||
|
||||
/** Input types that take no typed text: Escape there is not the field's. */
|
||||
const NON_TEXT_INPUTS = new Set([
|
||||
'checkbox',
|
||||
'radio',
|
||||
'range',
|
||||
'button',
|
||||
'submit',
|
||||
'reset',
|
||||
'color',
|
||||
'file',
|
||||
'image',
|
||||
])
|
||||
|
||||
/** A field that takes typed text (or a choice): Escape there belongs to the field. */
|
||||
export function isTextField(target: EventTarget | null): boolean {
|
||||
if (target instanceof HTMLInputElement) return !NON_TEXT_INPUTS.has(target.type)
|
||||
return (
|
||||
target instanceof HTMLInputElement ||
|
||||
target instanceof HTMLTextAreaElement ||
|
||||
target instanceof HTMLSelectElement ||
|
||||
(target instanceof HTMLElement &&
|
||||
target.closest('[contenteditable]') !== null)
|
||||
target.closest('[contenteditable="true"]') !== null)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user