简体   繁体   中英

Prevent reading every dynamic change: is there an aria-live=“zombie”?

I have a <div> tag where I'm updating the text every few milliseconds. Visually, I can see the text flashing by, which is good.

I want to make it an aria-live region so I can hear the text flashing by too, but I don't want JAWS to read every text change. It'll get too bogged down.

So if I change the text 4 times by the time jaws finishes reading the first change, I want jaws to ignore the other 3 changes and to just say the next change (5th change), and so on. The missed 3 changes aren't important.

So I sort of have an aria-live region that's not really alive and it's not really dead. I need some kind of zombie middle ground.

I've tried various combinations of 'polite' and 'assertive' as well as aria-busy but nothing I've tried works.

Any ideas?

You can keep an empty <div aria-live="polite"></div> in the bottom of your document. Then inject a copy of the text you want to say at certain intervals into the aria-live div and then remove the text from the aria-live div a second or so later.

Be careful how you use it though. I could see examples of usage being announcing percentage of loading, or for a live population counter where you may want to announce it every couple of seconds or so.

For the most part though let the screen-reader do what it's meant to do. Sometimes we over-think a solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM