phetsims / sun

User-interface components for PhET simulations, built on top of Scenery.
MIT License
4 stars 12 forks source link

AccessibleValueHandler has inconsistent context responses from rapid changes #863

Closed jessegreenberg closed 7 months ago

jessegreenberg commented 7 months ago

For greenhouse-effect, the context responses were inconsistent when using a11yCreateContextResponseAlert when changing the value rapidly to a new value and then back to the previous value. We tried to use the callback option in a way that would say nothing when the value didn't change. But depending on how fast you moved the thumb, we would still sometimes get a context response.

It is most likely happening because of the alertStableDelay on the Utterance used for the response. Assigning to me to investigate as part of greenhouse work.

jessegreenberg commented 7 months ago

It is actually not due to the delay but when the _valueOnStart is set. The _valueOnStart is set when interaction begins (no keys pressed). If you happen to press a second key fast enough so that the first key is still down, we don't update _valueOnStart.

In greenhouse-effect, we thought that was inconsistent behavior because we wrote sim specific code that suppressed the context response when the old value (_valueOnStart) was equal to the new value.

The behavior of valueOnStart is correct, it should re-set every key press. I think this is working as intended, and will shift to adding documentation to avoid confusion in the future.

jessegreenberg commented 7 months ago

This is no longer an issue for greenhouse-effect because we changed the implementation in that sim. And since I don't think it should change in sun, I am going to close this issue.

I DID update the documentation for CreateTextFunction to hopefully avoid confusion next time.