fix(richtext-lexical): enable select inputs with ctrl+a or cmd+a (#12453)
Fixes #6871 To review this PR, use `pnpm dev lexical` and the auto-created document in the `lexical fields` collection. Select any input within the blocks and press `cmd+a`. The selection should contain the entire input. I made sure that `cmd+a` still works fine inside the editor but outside of inputs.
This commit is contained in:
@@ -62,6 +62,24 @@ describe('Lexical Fully Featured', () => {
|
||||
const paragraph = lexical.editor.locator('> p')
|
||||
await expect(paragraph).toHaveText('')
|
||||
})
|
||||
|
||||
test('ControlOrMeta+A inside input should select all the text inside the input', async ({
|
||||
page,
|
||||
}) => {
|
||||
const lexical = new LexicalHelpers(page)
|
||||
await lexical.editor.first().focus()
|
||||
await page.keyboard.type('Hello')
|
||||
await page.keyboard.press('Enter')
|
||||
await lexical.slashCommand('block')
|
||||
await page.locator('#field-someText').first().focus()
|
||||
await page.keyboard.type('World')
|
||||
await page.keyboard.press('ControlOrMeta+A')
|
||||
await page.keyboard.press('Backspace')
|
||||
const paragraph = lexical.editor.locator('> p').first()
|
||||
await expect(paragraph).toHaveText('Hello')
|
||||
await expect(page.getByText('World')).toHaveCount(0)
|
||||
})
|
||||
|
||||
test('text state feature', async ({ page }) => {
|
||||
await page.keyboard.type('Hello')
|
||||
await page.keyboard.press('ControlOrMeta+A')
|
||||
|
||||
Reference in New Issue
Block a user