Components
← All components

Flash Bridge

stimeo--flash

Turns Rails flash elements into live-region announcements with auto-dismiss and stacking.

  • Rails / Turbo

The stimeo--flash controller bridges Rails flash elements (data-flash-type="notice|alert") into accessible notifications: it maps each message's type to role="status" (notice) or role="alert" (alert / error), flags it data-flash-state="visible", auto-dismisses it after duration (paused while hovered or focused when pauseOnHover, per WCAG 2.2.1), and caps the stack at max simultaneous messages. Reading is delegated to the shared Announcer — but only for the initial, page-loaded flashes, because an in-place live region present at load is not announced on its own; messages inserted later by Turbo Stream are announced by their own freshly inserted role, so they are not bridged twice. Dynamic inserts are detected with a MutationObserver, and a close control wired to the dismiss action removes one manually. Behavior only — no styling (data-flash-state="leaving" lets CSS animate removal); focus is never moved (WCAG 2.2 4.1.3), and the observer, timers, and per-message listeners are torn down on disconnect (Turbo navigation included).

running