# Feature: Toast Runtime

## Intent

Problem: toast styling does not provide announcement regions, timers, dismissal controls, or lifecycle cleanup.
Users or stakeholders: application teams, QA, keyboard users, screen reader users, and framework package maintainers.
Desired outcome: implement Toast behavior for static and dynamically inserted Seventh UI toast markup.
Non-goals: implement a global notification service, persistence, queue storage, or product-specific notification copy.

## Scope

In scope: toast region setup, show/hide state, auto-dismiss timers, manual dismissal, pause-on-hover/focus, announcement attributes, events, and cleanup.
Out of scope: application queueing, server communication, CSS transitions, and notification content generation.

## Markup Hooks

- Region: `[data-sui-toast-region]` or `[data-sui-component="toast-region"]`.
- Toast: `[data-sui-toast]` or `[data-sui-component="toast"]`.
- Dismiss: `[data-sui-toast-dismiss]` or `[data-sui-trigger="toast-dismiss"]`.
- State: `hidden`, `aria-hidden`, `aria-live`, and `data-sui-state`.

## Behavior

1. Showing dispatches `sui:toast:show`.
2. Dismissal dispatches `sui:toast:before-dismiss`; cancellation blocks dismissal.
3. Successful dismissal dispatches `sui:toast:dismiss`.
4. Auto-dismiss timers are configurable per toast.
5. Hover or focus can pause auto-dismiss when configured.
6. Toast regions maintain appropriate live-region attributes.
7. Cleanup clears timers and removes listeners.

## Accessibility

Use polite live regions by default and assertive regions only when explicitly requested. Manual dismissal controls must remain keyboard accessible.

## Acceptance Examples

Scenario: manual dismiss
Given a toast has a dismiss control
When the control is activated
Then the toast hides and `sui:toast:dismiss` is emitted.

Scenario: timer cleanup
Given a toast has an auto-dismiss timer
When the runtime is destroyed
Then the timer is cleared and no late dismissal fires.
