Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 aria-live 来宣布字符串。如何确保在宣布其他任何内容之前立即宣布该字符串?问题的第二部分是“aria-live 仅在文本更改时宣布”。如何重复宣布相同的字符串?
要立即宣布一个字符串,请使用aria-live="assertive"。"assertive" 将尽快向用户公布更新。您也可以使用aria-live="rude"立即宣布更新,即使这会打断用户。