Skip to content
fandhe-frontend
GitHub

Toast

fandhe-frontend-pre-styled-uitoast mod が提供するスタイル済み Toast 部品です。 一時的な通知を有界なキューとして管理する状態機械 Toaster を持ち、aria-live は通知の状態(ToastStatus)から決定的に導出します(Error のみ assertive、 他は polite)。aria-atomic="true" を併用し通知全体を単位として読み上げさせ ます。

関連 API: fandhe-frontend-pre-styled-ui API / fandhe-frontend-headless-ui API

Demo

headless-ui の Toast(`role="status"` + `aria-live`(`error` のみ `assertive`)+ `aria-atomic="true"`)に pre-styled-ui の placement(`group` slot)/status(`root` slot)variant CSS を適用した静的掲示です。複数通知の有界キュー管理・自動 dismiss のタイマー配線は wasm 層の後続イシューのスコープ外です。

Info
新しいバージョンが利用可能です。
Success
ビルドが完了しました。
Warning
依存クレート数が上限に近づいています。
Error
リンク切れを検出したため書き出しを中止しました。

Features

  • 一時的な通知の queue 表示。group(live region)/ root(通知 1 件)/ title / description / action-trigger / close-trigger の 6 anatomy パーツを持つ。
  • 複数通知を有界なキューとして管理する状態機械 Toaster を提供する(Disclosure/SingleSelect のいずれにも写像できないため Component/Hydrate を直接実装する)。
  • aria-live は ToastStatus から決定的に導出する(Error のみ assertive、他は polite)。aria-atomic="true" を併用し通知全体を単位として読み上げさせる。
  • placement(6 語彙、既定 BottomEnd)/ status(Info/Success/Warning/Error、既定 Info)の 2 軸 variant。

Anatomy

group
  root
    title
    description
    close-trigger

API Reference

Arguments

NameTypeDefaultDescription
placementToastPlacementToastPlacement::BottomEndgroup(live region)の表示位置(6 語彙)。
label&strgroup の role="region" に付与する aria-label(読み上げ用ラベル)。
statusToastStatusToastStatus::Info通知 1 件(root)の状態(Info/Success/Warning/Error)。aria-live の緊急度導出にも使われる。

Data Attributes

PartAttributeObserved Values
groupdata-placementbottom-end
rootdata-typeerror, info, success, warning

Accessibility

WAI-ARIA

AttributeDescription
role="region" / aria-labelgroup に付与。label 引数がそのまま aria-label になる。
role="status" / aria-atomic="true" / aria-liveroot に付与。aria-live は status から決定的に導出される(Error のみ assertive、他は polite)。