Skip to content

Commit d72afd1

Browse files
fix(web): live region repeats keep their non-breaking space
Restore the U+00A0 suffix a repeated announcement relies on, as an explicit escape. Rename subscribeConfirmDialog to subscribeConfirmDialogHost, since subscribing is what registers a host. Justify panelAnimations' two remaining effects: a two-frame paint wait and an exit-transition timer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9628509 commit d72afd1

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎apps/web/src/components/ConfirmDialogHost.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
completeConfirmDialogClose,
55
readConfirmDialogState,
66
respondToConfirmDialog,
7-
subscribeConfirmDialog,
7+
subscribeConfirmDialogHost,
88
} from "../confirmDialog";
99
import {
1010
AlertDialog,
@@ -52,7 +52,7 @@ function resolveConfirmDialogCopy(message: string): ConfirmationCopy {
5252

5353
export function ConfirmDialogHost() {
5454
const state = useSyncExternalStore(
55-
subscribeConfirmDialog,
55+
subscribeConfirmDialogHost,
5656
readConfirmDialogState,
5757
readConfirmDialogState,
5858
);

‎apps/web/src/confirmDialog.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import {
66
requestConfirmDialog,
77
resetConfirmDialogForTests,
88
respondToConfirmDialog,
9-
subscribeConfirmDialog,
9+
subscribeConfirmDialogHost,
1010
} from "./confirmDialog";
1111

12-
const mountHost = () => subscribeConfirmDialog(() => {});
12+
const mountHost = () => subscribeConfirmDialogHost(() => {});
1313

1414
function requireConfirmation(confirmation: Promise<boolean> | undefined): Promise<boolean> {
1515
if (!confirmation) {

‎apps/web/src/confirmDialog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export function readConfirmDialogState(): ConfirmDialogState {
4949
* Only themed hosts subscribe, so a subscriber is a mounted host. When the last
5050
* one leaves, pending confirmations resolve as cancelled.
5151
*/
52-
export function subscribeConfirmDialog(listener: () => void): () => void {
52+
export function subscribeConfirmDialogHost(listener: () => void): () => void {
5353
listeners.add(listener);
5454
return () => {
5555
if (!listeners.delete(listener) || listeners.size > 0) return;

‎apps/web/src/hooks/useLiveRegion.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function createLiveRegion() {
2929
cancelClear();
3030
// Screen readers ignore a write that leaves the text unchanged, so a repeat
3131
// gets a trailing non-breaking space to count as new.
32-
region.textContent = region.textContent === text ? `${text} ` : text;
32+
region.textContent = region.textContent === text ? `${text}\u00A0` : text;
3333
clearTimer = setTimeout(clear, CLEAR_AFTER_MS);
3434
};
3535

‎apps/web/src/panelAnimations.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export function usePanelNavigationSuppression(navigationKey: string): boolean {
1212
const [paintedNavigationKey, setPaintedNavigationKey] = useState<string | null>(null);
1313
const suppressed = paintedNavigationKey !== navigationKey;
1414

15+
// oxlint-disable-next-line t3code/react-effect-budget -- Wait two browser frames so the new route paints before panel animations are re-enabled; cancel the frames on change or unmount.
1516
useEffect(() => {
1617
if (!suppressed) return;
1718
let releaseFrame = 0;
@@ -55,6 +56,7 @@ export function usePanelPresence<T>(
5556
if (open && !present) setPresent(true);
5657
if (!open && !animated && present) setPresent(false);
5758

59+
// oxlint-disable-next-line t3code/react-effect-budget -- Keep the closing panel mounted for its CSS exit transition, then unmount it; the timer is cleared on reopen or unmount.
5860
useEffect(() => {
5961
if (open || !animated) return;
6062
const timeout = window.setTimeout(() => setPresent(false), durationMs);

0 commit comments

Comments
 (0)