Getting screen reader to read new content added with JavaScript

前端 未结 2 827
傲寒
傲寒 2020-11-30 00:53

When a web page is loaded, screen readers (like the one that comes with OS X, or JAWS on Windows) will read the content of the whole page. But say your page is dynamic, and

2条回答
  •  爱一瞬间的悲伤
    2020-11-30 01:26

    The WAI-ARIA specification defines several ways by which screen readers can "watch" a DOM element. The best supported method is the aria-live attribute. It has modes off, polite,assertive and rude. The higher the level of assertiveness, the more likely it is to interrupt what is currently being spoken by the screen reader.

    The following has been tested with NVDA under Firefox 3 and Firefox 4.0b9:

    
    
    
      
    
    
      
      

    The same thing can be accomplished with WAI-ARIA roles role="status" and role="alert". I have had reports of incompatibility, but have not been able to reproduce them.

    ...

提交回复
热议问题