-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyboard navigation to this sim #104
Comments
@jessegreenberg said:
I'm not super familiar with this sim, since I wasn't involved with it for very long. I inherited it and took it to the finish line. If it looks like keyboard navigation is working, great! |
Completed in above commits. Ready for review. |
@mbarlow12 Who would you like to review this? |
I'm looking at it now and can comment here when I have some feedback. |
Since I'm the responsible developer for this sim, I skimmed the code changed. Looks good. |
Thanks @mbarlow12. One thing I noticed is that when the play/pause buttons in the lab screen are pressed, focus is lost when the pressed button becomes invisible. A fix might be one of
I would recommend using Node.replaceChild() in this case. @pixelzoom @mbarlow12 do you have a preference? |
I don't understand what "when the pressed button becomes invisible" is referring to. We typically prefer to use |
Sounds good, thanks, we will brainstorm in scenery. |
@jessegreenberg I noticed this too, and agree that the focus shouldn't be lost. I recall a lot of trouble around that button's implementation, because we were using the button in a non-standard way- in the case of one ball the play doesn't become a pause button. Perhaps that is relevant. |
Thanks @amanda-phet. In phetsims/scenery#694 we added a function to Node called |
I'm on the fence about Node is huge (5116 lines) so we should think carefully about adding more stuff to it. Is The name |
Btw... And why isn't this sim using |
There is an issue in scenery for
I think so, the implementation of togglePlayPauseButtonVisibility: function() {
assert && assert( this.playButton.visible !== this.pauseButton.visible, 'the visibility of the play and pause buttons should alternate' );
var visibleButton;
var invisibleButton;
if ( this.playButton.visible ) {
visibleButton = this.playButton;
invisibleButton = this.pauseButton;
}
else {
visibleButton = this.pauseButton;
invisibleButton = this.playButton;
}
var buttonWasFocused = visibleButton.focused;
// swap visibility
visibleButton.visible = false;
invisibleButton.visible = true;
// the button that is now visible should receive keyboard focus if it is focusable and the invisible
// button had focus
if ( buttonWasFocused && invisibleButton.focusable ) {
invisibleButton.focus();
}
} |
Since there's a precedent for |
Linking to the |
I think it's generally useful, particularly since we should use it (when it makes sense) to future support a11y. The order of parameters in swapVisibility is exactly what I hoped for, so I wouldn't change it unless there's significant disagreement. |
So back to the specific focus issue in this sim... As I asked in #104 (comment), why isn't this sim using |
I forgot about ToggleNode, I will look into seeing if it can be used here. Definitely prefer to add a11y to common components. |
ToggleNode is now being used in |
Going through old, open issues and found this. @jessegreenberg it appears that the 'enter' interaction has been handled for this sim. However, I noticed one other item. If the PlayPause button is focused with the keyboard, all mouse interactions appear to be disabled until you move focus to another element with either the mouse or keyboard. Is this related to phetsims/sun#323? |
Thanks @mbarlow12, yes related to that issue. Should be fixed in the above commit can you please verify? |
…and phetsims/plinko-probablility#104
@mbarlow12 @jessegreenberg what is the status? Assigned to @mbarlow12 to review on 4/24. |
@jessegreenberg should focus shift to the slider on mouse interaction with the thumb? I'm seeing that an extra tab is required to regain focus after moving the slider (not the tweakers, though), and the focus is on the next element (e.g. the radio buttons after the play/pause button). I saw this also in Coulomb's Law, so I think this is in either NumberControl since this doesn't happen in RIAW or Ohm's Law. I'll make a separate issue to investigate, but I think this one can be closed. |
We would like to add keyboard navigation to this sim. When I use the ?accessibility query parameter, it looks like everything is already working with the keyboard, though focus order and focus highlights could be adjusted. Pinging @pixelzoom because he is the responsible dev, but since since everything seems to be already working with keyboard nav, I am going to assume we can proceed.
@mbarlow12 could you please choose an intuitive focus order (as long as reset all button is last) and maybe adjust focus highlights where it is occluding text and deploy a dev version for the design team to review?
The text was updated successfully, but these errors were encountered: