phetsims / utterance-queue

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

UtteranceQueue.getAriaLiveContainer doesn't belong in UtteranceQueue #23

Closed zepumph closed 2 years ago

zepumph commented 2 years ago

While working on https://github.com/phetsims/utterance-queue/issues/14#issuecomment-893094034, I was thinking that we should pull out as much AriaHerald-specific stuff as possible, because we have expanded the functionality of UtteranceQueue.

I don't think UtteranceQueue.fromFactory needs to change, because it serves as a great hello world, but we don't need a function specific to ariaLiveContainers hard coded on UtteranceQueue.

The only usages are from the a11y view:

      const ariaLiveElementsContainer = innerWindow.phet.joist.sim.display.utteranceQueue.getAriaLiveContainer();

I could see two ways forward.

  1. make UtteranceQueue.announcer public (I think I prefer this way). It is up to the user to know what announcer that instance of the UtteranceQueue is using.
  2. Make the AriaHerald instance on Display a member variable, and grab it from that.

@jessegreenberg would it be ok to go with number 1? Then the a11y views would look like:

      const ariaLiveElementsContainer = innerWindow.phet.joist.sim.display.utteranceQueue.announcer.ariaLiveContainer;
zepumph commented 2 years ago

I talked with @jessegreenberg, we agree, option 1!!!

zepumph commented 2 years ago

Implemented, closing.