-
Notifications
You must be signed in to change notification settings - Fork 6
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 input to Keypad #790
Comments
@matthew-blackman and I felt good enough getting to a commit point here. We wanted to note that there is still open keypad work But we still wanted to brainstorm some alt-input support for the keypad. We made some decisions along the way that we don't assume are set, but wanted to have something to work with. Open questions:
I'd love to speak with @jessegreenberg at some point to discuss some ideas about global listening, as he has more experience in that department. Next @matthew-blackman and I will look at using this in Projectile-Motion over in phetsims/projectile-motion#307 |
Is there a working example? I looked in projectile motion, but didn't see a keypad. |
@terracoda I don't think Projectile Motion has alt input enabled, though I could be wrong. Even so, the keypad is a bit hard to find. It's on the Lab screen, but you have to select "Custom" in the ComboBox and then click on the edit button next to the text field to bring up the keypad. |
It works, but interactive description isn't on by default. Try testing it out in with https://phet-dev.colorado.edu/html/projectile-motion/1.1.0-dev.39/phet/projectile-motion_all_phet.html?supportsInteractiveDescription=true&screens=4 |
@AgustinVallejo and I would like to have this in the alt-input of My Solar System, since it is already quite close. Assigning ourselves. |
…ort NumberPad keys in keypad, phetsims/scenery-phet#790
With phetsims/my-solar-system#86 making good progress on alt input in My Solar System, I took a stab at a few improvements here. We now ensure that you don't have duplicate keys kverwriting each other in the keyboard listener, and we support the NumberPad keys. I think it would be best to do a co-review with @jessegreenberg about the current progress of alt input in Keypad, I also would like to a @arouinfar and/or @terracoda take it for a test drive. You can try it in My Solar System by pressing clicking the number display next to the mass sliders. that opens a KeypadDialog: Have a look here: https://phet-dev.colorado.edu/html/my-solar-system/1.1.0-dev.4/phet/my-solar-system_en_phet.html |
Great, lets talk soon! I think phetsims/scenery@ffad825 is causing issues on CT like
Adding blocks-publication until we can take a look. |
I think that the reason it hadn't been done yet is because the keypad had no understanding of "submit". That exists outside of the
My effort focuses around what was already in Keypad. There are many other spots where scenery-phet/js/keypad/Keypad.ts Lines 33 to 48 in d5dcf86
Any other thoughts? |
Regarding #790 (comment). Fast typing is not working well because of this line: https://github.com/phetsims/scenery/blob/0e14250441d1c4a400ff92e6e635660bc106e54a/js/listeners/KeyboardListener.ts#L252 To prevent key groups that overlap keys (like "alt+r" and "alt+shift+r") from firing at the same time, the listener fires when exclusively the keys of a particular group are down. With fast typing, multiple number keys are down at once and so none of them fire. |
If we don't want to have something like |
You are so right. I think we should have something like |
…s for a key group, see phetsims/scenery-phet#790
I added an option
Just brainstorming on this consideration, not saying we should do it: All buttons themselves could remain focusable while number input is still supported by a listener on the Keypad. A |
Love it! 🎉 🎉 🎉
Makes sense to me, thanks for the clarification @zepumph.
Thanks @jessegreenberg that sounds like a good path forward when the time comes. |
Or, we could also add not that any Key that doesn't have a keyboardIdentifier provided, can automatically be focusable, that will make it very straight forward as to what keys are in fact supported by the common code implementation. I'll see if that is easy. It is kinda like future proofing ourselves. |
Ok. two pieces we are tracking in the same issue here:
|
@jessegreenberg and I worked on (2) and got a bit stuck. We will pick it up over in phetsims/scenery#1445. We are still fine with the current option, as it is helping us, though it is overly complicated. Ready to close! |
Over in phetsims/my-solar-system#86, @samreid found a bug in keypadLayer where pressing enter should also close the dialog. This occurs when you press the enter button, but when you press enter/space while the keypad is highlighted, it doesn't close the keypad. Let's fix it! |
This is a bit workaroundy, because the bug was based on the weirdness with keydown not forwarding correctly, but the keyup listener is quite idiomatic to "submitting" on our project, so I feel good about this solution. It also mimics how the actual enter button works just below the keypad. |
From phetsims/projectile-motion#307, @matthew-blackman and I would like to explore adding keyboard input to Keypad.
The text was updated successfully, but these errors were encountered: