Coder Social home page Coder Social logo

Comments (6)

payzer avatar payzer commented on May 18, 2024

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?

from tvhelpers.

jackhand avatar jackhand commented on May 18, 2024

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.

from tvhelpers.

payzer avatar payzer commented on May 18, 2024

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.

from tvhelpers.

jackhand avatar jackhand commented on May 18, 2024

that's weird that on a PC, no suppression is going on when I press the "ENTER" button.

from tvhelpers.

payzer avatar payzer commented on May 18, 2024

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.

from tvhelpers.

payzer avatar payzer commented on May 18, 2024

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.


                function createArrowHandler(direction, clampToBounds) {
                    var handler = function (oldFocus) {
                        return modeSite._view.getAdjacent(oldFocus, direction);
                    };
                    handler.clampToBounds = clampToBounds;
                    return handler;
                }

                var Key = _ElementUtilities.Key;
                this._keyboardNavigationHandlers[Key.upArrow] = createArrowHandler(Key.upArrow);
                this._keyboardNavigationHandlers[Key.downArrow] = createArrowHandler(Key.downArrow);
                this._keyboardNavigationHandlers[Key.leftArrow] = createArrowHandler(Key.leftArrow);
                this._keyboardNavigationHandlers[Key.rightArrow] = createArrowHandler(Key.rightArrow);

from tvhelpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.