0Pricing
Web Accessibility Academy · 课时

播报 Toast、加载器与计数

让异步界面变化能够被听见。

播报 Toast、加载器与计数 是 CoddyKit 上的免费 Web Accessibility Academy 课时。 这是第 3 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Web Accessibility Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Web Accessibility Academy 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Async UI Needs a Voice

Toasts, spinners, and result counts all change the page without a reload. Without a live region, screen reader users miss them entirely.

Toasts Should Announce

A toast is a brief pop-up message. Give its container role status so the screen reader speaks the text as it appears. 🍞

<div role="status">Item added to cart</div>

Keep the Toast Region Persistent

Render one empty toast region on load and inject messages into it. Creating a fresh region each time often fails to announce.

<div id="toasts" role="status"></div>

Loaders Tell Users to Wait

When data is loading, announce it. A polite status message like Loading results keeps users informed instead of guessing. ⏳

out.textContent = 'Loading results';

Then Announce the Finish

When loading ends, update the same region with the outcome. Pairing a start and end message gives a clear sense of progress.

out.textContent = 'Results loaded';

Announce Result Counts

After a search or filter, speak how many items matched. A short count message orients users who cannot scan the page visually.

out.textContent = '12 results found';

Counts Beat Silence

Updating a results list without a count leaves screen reader users unsure anything changed. One spoken number fixes that.

Keep Messages Short

Live announcements interrupt the reading flow, so keep each message concise. Saved beats Your changes were successfully saved just now.

Make Each Update Distinct

If new text is identical to the old, some screen readers stay silent. Vary the wording or clear the region first to force a re-read.

Do Not Hide With display none

A live region set to display none will not announce. To hide it visually, use a visually-hidden class that keeps it in the accessibility tree.

One Region, Many Messages

You usually need just one polite region for app-wide toasts and counts. Route updates through it instead of scattering many live elements.

Quick Check

Your toast region never announces. The CSS hides it with display none. What is the likely fix?

Recap: Announcing Async UI

You learned to voice toasts, loaders, and counts through a persistent polite region, keeping messages short and never using display none. ✅

常见问题解答

「播报 Toast、加载器与计数」课时是免费的吗?

是的 — 「播报 Toast、加载器与计数」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Web Accessibility Academy 课程的其余内容,请升级到 CoddyKit PRO。 Web Accessibility Academy 课程共包含 4 节课。

「播报 Toast、加载器与计数」这节课中我会学到什么?

让异步界面变化能够被听见。 你通过在浏览器中直接运行的动手代码来练习 Web Accessibility Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Web Accessibility Academy 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Web Accessibility Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 3 节课,共 4 节。

「播报 Toast、加载器与计数」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Web Accessibility Academy 课中编写并运行代码吗?

能。每节 Web Accessibility Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. polite 还是 assertive:选择紧急程度
  2. status、alert 与 log 角色
  3. 播报 Toast、加载器与计数
  4. 实时区域为何失效以及如何修复
← 返回 Web Accessibility Academy