Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

126
Visualizações
Screenreader read content again although the role log is used

i want to create a little chat application. I also want to use the screenreader to read the text to me. ( Continously updates should be read ).

So: It should be really easy by using the role "log".

<div id="canvas">
    <div id="messages" role="log">
        <ul id="test">
            <li>Row 1</li>
            <li>Row 2</li>
        </ul>
    </div>
</div>

But in my specical case I need to clear the parent div and creae the following content of it.

document.getElementById("canvas").innerHtml = "";

I noticed that if I fill the list again, that the screanreader will read all items again. But I will that the screenreader remebers the last state.

So I thought to cache the container like

let cache = document.getElementById("messages")
document.getElementById("canvas").innerHtml = "";
document.getElementById("canvas").append(cache);

But this also overwrite the state. I am using iOS VoiceOver. Is there a way to reach my special case? Or does someone has any ideas? Or is the only way to make sure that the parent will not be cleared?

Thank you a lot

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Short answer

That's simple: if you don't want existing content to be repeated, you shouldn't touch it. Append the new content instead.

If your framework replaces too many (useless) things, your framework is doing bad, or it has to be improved.

Longer answer

How screen readers and ARIA live regions work

The screen reader basically monitors changes occurring in the DOM tree, in the regions it has been told to look at (the so called ARIA live regions). This is how it works in most, if not all, screen readers, browsers and OS.

Therefore, if you remove everything from one element and add it again, even it the actual text content hasn't changed, it will be read again.

Look at the screen reader point of view: in fact, it isn't desirable to make a precise analysis of what has been changed exactly in place, as you describe.

For example, Google Chrome Windows had that kind of problem in the past: if you wrote "It was cool" and than replaced by "It was cold", there were a tendency to have only "ld" read, which, of course, doesn't make sense as such. The precise analysis was probably made by the browser before communicating to the screen reader, and not in the screen reader, because it worked fine in other browsers.

But think deeper: what should be read in such a case ? Only the new word "cold" ? The entire sentence ? The paragraph ? The whole element ? Even if it's several paragraphs long ? If the content is exactly the same, has the text to be repeated, or nothing should be spoken at all, as if nothing happened ?

The answers depends a lot on the context and the screen reader can't decide to take a constant behavior once for all. So, it's simpler to just follows what happens in the DOM, and hope that the designer will update only what makes sense at the right time.

Aria-atomic and aria-relevant

In theory, it's supposed to work like as follows, but there are still several screen readers that don't totally respect these two attributes correctly.

  • If aria-atomic is set to true, the whole content of the live region has to be read again. If set to false, only changed content has to be read.
  • ARia-relevant indicates what should be read: additions (new content), removals (deletions), or both.

Note in particular that a replacement is nothing else than a removal followed by an addition, and hence, it doesn't help to solve your problem.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda