phetsims / utterance-queue

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

Shouldn't announceImmediately use canAlertUtterance? #25

Closed zepumph closed 2 years ago

zepumph commented 2 years ago

Even though this function is meant to immediately announce an utterance, bypassing the queue, it still feels like we should be utilizing the same type of algorithm where we adhere to the Utterance's predicate. What do you think?

zepumph commented 2 years ago

One reason I want this is so that in https://github.com/phetsims/utterance-queue/issues/22 we can use UtteranceQueue.canAlertUtterance as a central place to check if PhET-iO state is being set. Would that work?

zepumph commented 2 years ago

I spoke with @jessegreenberg, we will add this support, and perhaps factor this out with the announce() call to another function in UtteranceQueue called both by immediately and not immediately announcings.

zepumph commented 2 years ago

I ended up getting rid of canAlertUtterance, in exchange for a factored out function that checks the same conditions, and then announces (attemptToAnnounce). Closing