Reputation: 1
I wanted to use <output>
element, because I thought it's the best solution in terms of accesibility (and maybe SEO) for calculated valeus (I have two <input>
s and one <output>
). NVDA reads all changed outputs first, and then all labels.
I also use JS, somthing like this:
input1.addEventListener("input", ev => {
let calculations = ev.target.value * smth;
// ...
installment.textContent = calculations + " EUR";
}
I tried some of this solutions but it doesn't work on Windows + Edge + NVDA:
<label for="installment">Installment: </label>
<output id="installment"></output>
and
<label id="installment_label">Installment: </label>
<output id="installment" aria-labelledby="installment_label"></output>
I also tried to add role="status"
but it didn't work as well.
Edit:
<label id="installment_label" aria-live="assertive">Installment:
<span id="installment" aria-labelledby="installment_label"></span>
</label>
What would by the best solution? Should I stay with <label id=x><span aria-labelledby=x>
?
Upvotes: -1
Views: 44
Reputation: 8064
You should try something like this, using aria-atomic
:
<label for="installment">Installment:</label>
<output id="installment" aria-live="polite" aria-atomic="true"></output>
When set to
aria-atomic="true"
, the entire changed region as a whole will be presented, including the updated node'slabel
, if there is one.
Upvotes: 0