phetsims / utterance-queue

Alerting library powered by aria-live
MIT License
0 stars 2 forks source link

VoiceOver reads AriaLiveAnnouncer alerts out of order #88

Closed jessegreenberg closed 1 year ago

jessegreenberg commented 1 year ago

From https://github.com/phetsims/greenhouse-effect/issues/192. Controlling this was the entire motivation for UtteranceQueue back in the day so I am surprised to see this.

I have an event that adds multiple alertables to the UtteranceQueue synchronously with Alerter.js

this.alert( alertable1 )
this.alert( alertable2 )
this.alert( alertable3 )

And I expected VoiceOver to read them in that order. But in https://github.com/phetsims/greenhouse-effect/issues/192, they get spoken in order:

alertable2
alertable3
alertable1
jessegreenberg commented 1 year ago

I have a proposed fix for this by using the Announcer feature readyToAnnounce. Now AriaLiveAnnouncer uses readyToAnnounce to prevent the UtteranceQueue from sending alerts too quickly to the screen reader. I am hoping the additional delay will force the reader to speak them in FIFO order. But I am not able to test, I have asked for assistance in testing in https://github.com/phetsims/greenhouse-effect/issues/192

jessegreenberg commented 1 year ago

QA confirmed this change fixed the problem and AriaLiveAnnouncer has been working well in user interviews and dev tests. @zepumph I wanted to make sure using readyToAnnounce in AriaLiveAnnouncer for this was OK with you. We had previously only been using it for SpeechSynthesisAnnouncer cases.

If that seems OK, this can be closed.

zepumph commented 1 year ago

This makes sense to me, and I understand this. Can you please add a few sentences about how this regression happened, because it isn't clear to me how our overhaul of the utterance-queue for voicing meant that we HAD to use readyToAnnounce for aria-live. Is this a regression with how screen readers behave? UtteranceQueue didn't use to need to wait for that timeout to complete to send the next one.

zepumph commented 1 year ago

Feel free to close after an explanation is all seems good to you.

jessegreenberg commented 1 year ago

Yes, I don't think this was caused by any of our code - I think VoiceOver changed something. The order of UtteranceQueue and the rate it moved through Utterances (basically every stepTimer step) used to be enough to force FIFO order. But something changed and now it takes some delay to enforce the order. 200ms seemed to work OK for now.