The sub-bullet of #451 said the focus does not enter the window at the
opening, which this PR makes false: its parenthetical now points to the
sub-bullet of #494. One sub-bullet for #494 (PR #511) at the end of
"Vérifications dues à la release suivante", with the checks a test
cannot make: real Tab order, visible focus ring, focus given back after
X, Escape and "J'ai déjà une clé", screen readers, both hosts of
ProfileFormModal.
Resolves#494
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs/architecture.md: 30 hooks (tree, title, the sentence of the
count command); a "Hook transverse — useDialogFocus" section after
useCollapsibleGroups; the UpsellDialog row of the gates table says
what the window now does with the focus (the "suivi #494" sentence
goes), the multi-profile row names ProfileFormModal's dialog markup;
"Tests (vitest sans jsdom)": fakes reach the refs through props.ref,
never a preset slot, the harness never empties a ref; harness users
27 -> 29 and elementTree importers 23 -> 24 (texts 7 -> 9), counted
by the commands the section cites.
- CLAUDE.md: "29 hooks custom" -> 30.
- CHANGELOG.md, CHANGELOG.fr.md: the #451 line under Changed / Modifié
says what #494 changes for the user, (#451, #494).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A shared hook, useDialogFocus, gives a modal window its focus: on its X
once mounted, Tab and Shift+Tab looped inside by an onKeyDown handler on
the dialog element (never on document, where Escape is listened for),
and given back in the effect's cleanup, so on every way out: to
returnFocusTo when the host passes it and it holds an element, otherwise
to the element active at mount, unless that one is body or no longer in
the document.
- UpsellDialog: refs on its X and on the dialog element, an optional
returnFocusTo, the Tab handler; the Escape listener is unchanged.
- ProfileSwitcher: its trigger gets a ref, passed to UpsellDialog and
ProfileFormModal, type="button" and aria-expanded={open}, without
aria-haspopup since the list is not a role="menu".
- TransactionTable: an effect, placed before the early return of an
empty table, clears showSplitUpsell once the access is open, so an
upsell that went away with the edition never comes back on its own.
- ProfileFormModal: role="dialog", aria-modal, aria-labelledby to its
title (static id), aria-label and type="button" on its X, Escape that
closes like the X except while saving, the same focus hook; entering
the upsell puts the focus on the X, every return to the list (cancel,
save, deletion) on "Create", never at mount.
Tests: useDialogFocus.test.ts and ProfileFormModal.render.test.tsx are
new; UpsellDialog, ProfileSwitcher, TransactionTable and the deletion
of ProfileFormModal get their cases. Fakes reach the refs through
props.ref, never through a preset slot of the harness.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>