fix(editor): Plus Escape focus return, sheet width rounding
This commit is contained in:
1 parent
021685f6b3
commit
3a7ffa2f8b
3 files changed
+42
-18
No files matched your search
@@ -233,16 +233,28 @@ describe('the platform back request', () => {
|
||||
})
|
||||
|
||||
describe('final review: keyboard focus leaving « Plus » (M-8)', () => {
|
||||
it('closes when the focus moves out of the trigger and the list', async () => {
|
||||
it('closes when Tab moves the focus out of the trigger and the list', async () => {
|
||||
const { user } = mount()
|
||||
await user.click(more())
|
||||
const item = screen.getByRole('button', { name: 'Constats' })
|
||||
act(() => item.focus())
|
||||
expect(more()).toHaveAttribute('aria-expanded', 'true')
|
||||
const items = [...list()!.querySelectorAll('button')]
|
||||
act(() => more().focus())
|
||||
await user.tab()
|
||||
expect(items[0]).toHaveFocus()
|
||||
expect(more()).toHaveAttribute('aria-expanded', 'true')
|
||||
act(() => screen.getByRole('button', { name: 'outside' }).focus())
|
||||
act(() => items.at(-1)!.focus())
|
||||
await user.tab()
|
||||
expect(document.activeElement?.closest('#editor-tabs-more')).toBeNull()
|
||||
expect(more()).toHaveAttribute('aria-expanded', 'false')
|
||||
await gone()
|
||||
})
|
||||
|
||||
it('a focus placed elsewhere by the page keeps it open: Escape closes it and returns the focus', async () => {
|
||||
const { user } = mount()
|
||||
await user.click(more())
|
||||
act(() => screen.getByRole('button', { name: 'outside' }).focus())
|
||||
expect(more()).toHaveAttribute('aria-expanded', 'true')
|
||||
await user.keyboard('{Escape}')
|
||||
expect(more()).toHaveAttribute('aria-expanded', 'false')
|
||||
expect(more()).toHaveFocus()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user