Closed Nancy-Salpepi closed 4 months ago
Reproduced in main, this affects all sims that have NumberSpinner and FineCoaseSpinner.
NumberSpinner and FineCoaseSpinner are common-code components that extends AccessibleNumberSpinner
, which extends AccessibleValueHandler
. @jessegreenberg was it an intentional part of the design not to have Home/End sounds for these UI components, or is this an oversight?
@jessegreenberg is out this week, so this may be blocked until 7/8.
@pixelzoom I'm inclined to think this is an oversight. There's a possible paper trail in https://github.com/phetsims/fourier-making-waves/issues/192 and https://github.com/phetsims/sun/issues/697 that I'm still looking through.
Summary from Slack#design-sims (see below) is that we should add sound for the Home/End buttons, and use the same sound as for the arrow buttons. I'll investigate how to do this.
I've discovered that sound for NumberSpinner
and FineCoarseSpinner
is not handled by AccessibleNumberSpinner
. Those classes actually press the buttons when arrow keys are pressed, which results in the buttons making sounds. For example in NumberSpinner:
// pdom - NumberSpinner uses AccessibleValueHandler for accessibility, but it was decided that keyboardStep
// and shiftKeyboardStep should have the same behavior as the NumberSpinner ArrowButtons AND the ArrowButtons
// should look depressed when interacting with those keys. To accomplish this we actually press the ArrowButtons
// in response to input with those keys. keyboardStep and shiftKeyboardStep are set to zero so the value isn't
// modified again by AccessibleValueHandler. See https://github.com/phetsims/scenery/issues/1340.
assert && assert( options.keyboardStep === undefined, 'NumberSpinner sets keyboardStep, it will be the same as deltaValue' );
assert && assert( options.shiftKeyboardStep === undefined, 'NumberSpinner sets shiftKeyboardStep, it will be the same as deltaValue' );
assert && assert( options.pageKeyboardStep === undefined, 'NumberSpinner sets pageKeyboardStep, it should not be used with NumberSpinner' );
options.keyboardStep = 0;
options.shiftKeyboardStep = 0;
options.pageKeyboardStep = 0;
...
// pdom - click arrow buttons on press of arrow keys so that the Property value changes by deltaValue
// and the buttons look depressed
const increasedListener = ( isDown: boolean ) => ( isDown && incrementButton.pdomClick() );
const decreasedListener = ( isDown: boolean ) => ( isDown && decrementButton.pdomClick() );
this.pdomIncrementDownEmitter.addListener( increasedListener );
this.pdomDecrementDownEmitter.addListener( decreasedListener );
Moving the general issue of adding Home/End sounds to https://github.com/phetsims/sun/issues/886. This issue is blocked until that is resolved.
To unblock this issue, I created sim-specific subclasses of NumberSpinner and FineCoarseSpinner that add sound for the Home/End buttons, see https://github.com/phetsims/gas-properties/commit/280850da784b3695b43134c20f06716b3f4d1801. Those subclasses will need to be removed when this problem has been addressed generally in https://github.com/phetsims/sun/issues/886, as I've noted in that issue and a TODO
code comment.
@Nancy-Salpepi please review, close if OK. Home/End should make the same sound left/right/up/down keys.
I now hear sounds when jumping to min/max.
One oddity I see is if I am already at the max value and press the up or right arrow I won't hear a sound, but if I press the End key I will still get a sound. The same things happens when at the min value.
@Nancy-Salpepi said:
One oddity I see is if I am already at the max value and press the up or right arrow I won't hear a sound, but if I press the End key I will still get a sound. The same things happens when at the min value.
Discussed with @Nancy-Salpepi ... To clarify, we're hearing the Home/End sounds when we're already at max/min. That's undesirable, and not like (for example) Slider.
Unfortunately, I can’t check the value to see if we’re at max/min already, because NumberSpinner (AccessibleValueHandler probably) is setting the value to max/min before my workaround code is called. I don’t think that’s worth holding things up. So we will live with this workaround. I’ll make a note to handle it properly in https://github.com/phetsims/sun/issues/886. And I'll close this issue.
Test device MacBook Air M1 chip
Operating System 14.5
Browser Chrome
Problem description https://github.com/phetsims/qa/issues/1100, on all screens when I jump to the min/max of the number spinners there is no sound. There is a sound when I jump to the min/max of a slider. I know that these are UI sounds that were "turned on" for the sim, so if this is scope creep than feel free to ignore!
Steps to reproduce On any screen, tab to a number spinner and press the
home
andend
keys.