Skip to content

[Bug] Toast: the auto-hide pause is one flag, so a toast can hide while focus is inside it #8969

Closed

Description

@duytbp

Description

A toast's auto-hide pause is a single flag, isPausedRef (Toast.tsx:188-233). Every pause source sets it and every end of one clears it: pointer enter/leave, focus in/out (capture), touch gestures and window blur/focus (Toast.tsx:253-254, 293-296). So the timer restarts when any one condition ends while another still holds:

  • Tab or click into a toast's action, then move the pointer off the toast: mouseleave resumes the timer while focus is still inside, and the toast can hide (and take focus with it) while the user is on its action.
  • Hover a toast, switch windows and back: window focus resumes the timer while the pointer is still over it.

Also, a toast raised while the window is already blurred starts its timer at once (no document.hasFocus() check at start), so it can expire before the user ever returns to the tab.

Toast's spec records both under FR2's implementation gaps. FR2 and AR3 require the timer to pause while the user reads or interacts (WCAG 2.2.1 Timing Adjustable).

Expected: track each pause source separately and resume only when none holds; start the timer paused when the document does not have focus.

Reproduction

import {Button, useToast} from '@astryxdesign/core';

export function Repro() {
  const toast = useToast();
  return (
    <Button
      label="Show toast"
      onClick={() =>
        toast({
          body: 'Draft saved',
          endContent: <Button label="Undo" size="sm" onClick={() => {}} />,
          autoHideDuration: 5000,
        })
      }
    />
  );
}
  1. Press "Show toast", then Tab to "Undo". Focus is inside the toast, so its timer is paused.
  2. Move the pointer over the toast and off it again.
  3. About 5 s later the toast hides, although focus never left "Undo", and focus drops to <body>.

For the blurred case: call toast() from a setTimeout, switch to another tab before it fires, and come back after autoHideDuration: the toast is gone.

Astryx Version

@astryxdesign/[email protected], still present on main (14fc587)

Environment

Chromium 156 (Playwright, real pointer and keyboard). Not browser-specific.

Activity

  1. added
    bug
    component
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityarea:corebugcomponent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions