VoiceOver 以系统语言 (en) 读取 aria-live 的内容,即使应用了 lang="nl"如何改变?

问题描述

我的页面上有一个实时区域。整个页面都是荷兰语(应用了 lang="nl" 上的 <html>),并且对于大多数文本,一切正常。但是,如果我使用带有 aria-live 的实时区域,即使我将 lang="nl" 放在实时区域本身上,文本也会以系统语言显示

这是 VoiceOver 中的错误吗?还是我做错了什么?

我做了一个代码笔来演示:https://codepen.io/petergoes/pen/LYbagMw

代码

<div lang="nl">
    <span id="output" aria-live="polite"></span>
</div>

<button id="fill-en">Add English text</button>
<button id="fill-nl">Add Dutch text</button>
const enText = "This is some text in English"
const nlText = "Dit is wat tekst in het Nederlands"
const $enButton = document.querySelector('#fill-en')
const $nlButton = document.querySelector('#fill-nl')
const $output = document.querySelector('#output')

$enButton.addEventListener('click',() => {
    $output.lang = 'en'
    $output.innerText = enText
})

$nlButton.addEventListener('click',() => {
    $output.lang = 'nl'
    $output.innerText = nlText
})

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)