Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

press 'A' button on xbox console Edge browser doesnt trigger anything  #45

@kennyma603

Description

@kennyma603

I was using exactly the same code from https://raw.githubusercontent.com/Microsoft/TVHelpers/master/tvjs/examples/DirectionalNavigation/ModalDialog/ModalDialog.html

the only different was i added <script src="gamepadtokey-1.0.0.0.js"></script> before directionalnavigation-1.0.0.0.js script tag, because i wanted to use xbox controller.

serve ModalDialog.html using a local server, then on xbox, open up edge broswer, then load ModalDialog.html (using ip address, eg: 10.10.10.123:7000/ModalDialog.html)

try to press open modal button, nothing happen.

i did some debugging, press 'A' button on controller hit line 603 from directionalnavigation-1.0.0.0.js

i did "alert(e.srcElement.outerHTML);" for debugging.
it turns out no matter where you click A, on a button or input field, the e.srcElemetn is always .
and e.srcElement.click(); would not work.

function _handleKeyUpEvent(e) {
    alert(e.srcElement.outerHTML);
    if (e.defaultPrevented) {
        return;
    }
    if (_keyCodeMap.accept.indexOf(e.keyCode) !== -1) {
        e.srcElement.click();
    }
};

i guess the problem is on the gamepadtokey.js,

function raiseEvent(name, key, keyCode) {
    var event = document.createEvent('Event');
    event.initEvent(name, true, true);
    event.key = key;
    event.keyCode = keyCode;
    document.body.dispatchEvent(event);
};

the event is always trigger from document body, not the element that you are actually on.

is it a bug? or intended?

index.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions