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
@@ -21,6 +21,7 @@ import ReferencesPanel from '@/components/editor/references/ReferencesPanel'
|
||||
import AnnotationsTab from '@/components/editor/tabs/AnnotationsTab'
|
||||
import {
|
||||
FocusConsumedContext,
|
||||
isTextField,
|
||||
ownedBy,
|
||||
type FocusRequest,
|
||||
} from '@/editor/focusRequest'
|
||||
@@ -373,3 +374,28 @@ describe('a consumed request', () => {
|
||||
expect(document.activeElement?.getAttribute('data-focus-key')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('isTextField', () => {
|
||||
const input = (type: string) => {
|
||||
const element = document.createElement('input')
|
||||
element.type = type
|
||||
return element
|
||||
}
|
||||
|
||||
it('is true for what takes typed text', () => {
|
||||
for (const type of ['text', 'search', 'email']) {
|
||||
expect(isTextField(input(type))).toBe(true)
|
||||
}
|
||||
expect(isTextField(document.createElement('textarea'))).toBe(true)
|
||||
expect(isTextField(document.createElement('select'))).toBe(true)
|
||||
})
|
||||
|
||||
it('is false for a checkbox, a radio, a range, a button input', () => {
|
||||
for (const type of ['checkbox', 'radio', 'range', 'button', 'file']) {
|
||||
expect(isTextField(input(type))).toBe(false)
|
||||
}
|
||||
const off = document.createElement('div')
|
||||
off.setAttribute('contenteditable', 'false')
|
||||
expect(isTextField(off)).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user