fix(editor): deletion undo and Back, Plus focus to the panel

This commit is contained in:
bchanot committed 2026-11-14 14:24:06 +01:00
1 parent 270444e2ec
commit 085c56877c
14 files changed
+252 -18

No files matched your search

@@ -41,6 +41,12 @@ function Page({
>
<div data-editor-workspace>
<EditorTabs active={active} tier="small" onSelect={setActive} />
<div
id={`editor-panel-${active}`}
role="tabpanel"
tabIndex={-1}
aria-label={active}
/>
<button type="button">outside</button>
</div>
<button type="button" onClick={() => setActive('general')}>
@@ -91,6 +97,35 @@ describe('the overlay', () => {
})
})
describe('the panel takes the focus after a pick', () => {
it('Enter on an entry focuses the panel of that tab once the list is gone', async () => {
const { user } = mount()
await user.click(more())
screen.getByRole('button', { name: 'Constats' }).focus()
await user.keyboard('{Enter}')
await gone()
expect(document.activeElement).toBe(
document.getElementById('editor-panel-findings'),
)
})
it('a pointer pick does the same', async () => {
const { user } = mount()
await user.click(more())
await user.click(screen.getByRole('button', { name: 'Constats' }))
expect(document.activeElement).toBe(
document.getElementById('editor-panel-findings'),
)
})
it('Escape still returns the focus to « Plus »', async () => {
const { user } = mount()
await user.click(more())
await user.keyboard('{Escape}')
expect(document.activeElement).toBe(more())
})
})
describe('the render-time reset', () => {
it('a new active tab closes the open menu with no click in the row', async () => {
const { user, force } = mount()