gpt4 book ai didi

javascript - 什么是 Angular Material 中的 mdLiveAnnouncer 及其工作原理?

转载 作者:太空宇宙 更新时间:2023-11-04 08:58:27 25 4
gpt4 key购买 nike

谁能用这段代码向我解释一下 $mdLiveAnnouncer

module.controller('AppCtrl', function($mdLiveAnnouncer) {
// Basic announcement (Polite Mode)
$mdLiveAnnouncer.announce('Hey Google');

// Custom announcement (Assertive Mode)
$mdLiveAnnouncer.announce('Hey Google', 'assertive');
});

最佳答案

根据他们的 documentation .

The $mdLiveAnnouncer service is internally used for components to provide proper accessibility. $mdLiveAnnouncer.announce(message, politeness);

Announces messages to supported screenreaders.

当您说它什么都不做时...您是否尝试过在支持屏幕阅读器的设备上运行它?

根据 GitHub 上的文档(链接在上面的文档中):

  • Both JAWS and NVDA over IE11 will not announce anything without a non-zero timeout.
  • With Chrome and IE11 with NVDA or JAWS, a repeated (identical) message won't be read a second time without clearing and then using a non-zero delay. (using JAWS 17 at time of this writing).

关于javascript - 什么是 Angular Material 中的 mdLiveAnnouncer 及其工作原理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42946964/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com