屏幕阅读器无法读取 Firefox 中的 Aria-Live

Nay*_*ish 5 html javascript firefox accessibility aria-live

我遇到一个问题,屏幕阅读器无法读取 FireFox 中 aria-live 部分中更改的文本。

这是一个简单的页面示例,在 Chrome 中,屏幕阅读器会在更改发生时读取更改,而在 FireFox 中则不会:

<div aria-live="assertive" id="moo">

</div>
<script>
  let i = 0;
  setInterval(() => {
    document.getElementById('moo').innerText = 'moo' + i++
  }, 2000)
</script>
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么?除了人们在 Firefox 中使用的 aria-live 之外,还有其他方式在更改出现时宣布更改吗?

我在 Mac-Firefox-VoiceOver 上进行了测试(它适用于 Mac-Chrome-VoiceOver)

Ale*_*xee 2

当前的 firefox 版本: 83.0 (64-bit)
\nFirefox Nightly 版本\xef\xbc\x9a 85.0a1 (2020-11-29) (64-bit) \n在最新的 Nightly 版本中, firefox 上的 aria-live +
的组合画外音已修复!万岁!

\n

参考: \n Firefox/Voiceover:aria-live 区域尚未公布

\n

\r\n
\r\n
<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="UTF-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <title>Aria-live Demo</title>\n  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>\n  <style>\n    body {\n  margin: 1em;\n}\n\nbutton {\n  margin-top: 1em;\n  display: block;\n}\n  </style>\n</head>\n<body>\n  <h1>Aria-live Demo</h1>\n  <p>Testing <code>aria-live</code><br><button>Add Content</button><button id="add-more" >Add more content</button></p>\n\n  <!-- add aria-live="polite" -->\n  <div class="target" aria-live="polite" ></div>\n \n  <script type="text/html" id="test-content">\n    <h2>Custom Content</h2>\n    <p>Hello there! I am content that is going to be plunked into a container via javascript</p>\n  </script>\n\n  <input placeholder="messgae somebody"/>\n<script>\n$("button").on("click", function(){\n  $(".target").html($("#test-content").html());\n});\n\n$("#add-more").on("click", function(){\n  $(".target").append("<p>Hello World</p>");\n});\n\n$(document).on("keydown", function(e){\n  // press space to add content\n    if(e.keyCode === 32) {\n        $(".target").append("<p>Hello World</p>");\n    }\n});\n\n</script>\n</body>\n</html>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n