fix(app): focus the shown tab after a crossing, one commit per typed field
- A field blurred by a 1 024 px crossing or a read-only switch hands its focus to the shown tab (or Plus), never to body (focusRequest, useViewport). - TextField no longer commits a blurred value twice when it unmounts before the render that brings the new value: one undo step, one count. - Annuler and Retablir share the field left by Tab, so Shift+Tab to Annuler and Enter still skips the undo of a refused field. - Adding a reference clears the finding filter and the search. Unit tests: no-loss (focus on tab and on Plus, one undo entry), history buttons (field kept across the pair), references panel (add clears, refused add keeps).
This commit is contained in:
1 parent
9c03cf2413
commit
0bb150f860
9 files changed
+149
-29
No files matched your search
@@ -269,6 +269,26 @@ describe('typed text and the press', () => {
|
||||
expect(store.getState().undo).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('a field left through « Rétablir » to « Annuler » still skips the undo', async () => {
|
||||
const user = userEvent.setup()
|
||||
mountDraft()
|
||||
await ready()
|
||||
act(() => void commitMove(40))
|
||||
const field = await selectAnnotation(user)
|
||||
await user.clear(field)
|
||||
field.blur()
|
||||
const redo = screen.getByRole('button', {
|
||||
name: 'Rétablir la dernière modification annulée',
|
||||
})
|
||||
act(() => redo.focus())
|
||||
fireEvent.focus(redo, { relatedTarget: field })
|
||||
act(() => undoButton().focus())
|
||||
fireEvent.focus(undoButton(), { relatedTarget: redo })
|
||||
await user.keyboard('{Enter}')
|
||||
expect(field).toHaveFocus()
|
||||
expect(store.getState().undo).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('Ctrl+Z is ignored while a DeleteDialog is open', async () => {
|
||||
mountDraft()
|
||||
await ready()
|
||||
|
||||
Reference in new issue
Block a user