-
Notifications
You must be signed in to change notification settings - Fork 56
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
DirectionalNavigation: Xbox Gamepad "A" button not triggering winJS ListView's oniteminvoked event handler #18
Comments
This is probably because the key codes for gamepad are slightly different than the key codes for other keys like enter. On Xbox, if you have a normal button, does the gamepadA key trigger a button click? |
The key code for the "A" button is 195 and this does cause the DirectionalNavigation code to successfully call "e.srcElement.click()" within the _handleKeyUpEvent() function. It only seems to be the ListView tiles. The Hub headers trigger an invoke handler when I press the gamepadA key. Other buttons trigger their invoke handler when the gamepadA key is pressed. |
I see. Unfortunately the ListView is "special". What's likely going on is the ListView is either preventing the default click action or suppressing the input in some other way. It's very unfortunate. I'm not sure if there's a workaround other than disabling that code in the WinJS source. |
that's weird that on a PC, no suppression is going on when I press the "ENTER" button. |
Yes, that's probably because the ListView will explicitly check for the enter key, but not the gamepad keys (XboxJS checked the gamepad keys), but WinJS 1.0 - WinJS 4.0 did not. I'd suggest adding the gamepad keys to the ListView where the Enter keys are handled. I'll probably be able to get an example together later today. |
Here's where we modified the ListView code for XboxJS: You can add additional lines like the existing ones for the arrow keys, except add the gamepad keycodes.
|
When pressing the "A" button of the Xbox gamepad, the ListView tile that is in focus does not invoke the oniteminvoked event handler. However, when testing this on the computer (not Xbox) and I press the ENTER key on the keyboard, then the oniteminvoked event handler gets triggered.
The _handleKeyUpEvent() function of the DirectionalNavigation code does get called, but for some reason the following code that is called when testing on the Xbox does not invoke a call to the ListView's oniteminvoked event handler.
e.srcElement.click();
Why does it work on the PC, but not on the XboxOne?
The text was updated successfully, but these errors were encountered: