cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matb33 <>
Subject [GitHub] cordova-android pull request: Consider treating gamepad B button a...
Date Sat, 30 May 2015 16:10:02 GMT
GitHub user matb33 opened a pull request:

    Consider treating gamepad B button as a Back button

    I don't expect this to get merged, but am simply putting this out there for discussion.
The pull request is simply here for convenience to quickly show you a diff.
    The motivation behind this change is driven by how the `keyCode` value for many gamepad
buttons is reported as `0` in `keydown` (and `keyup`) events in Javascript.  It makes it pretty
much impossible to manually discern the `B` button from the others. The `B` button is, as
far as I know, universally accepted as a "back" button.
    I realize implementing gamepad code manually using the HTML5 APIs would allow one to discern
buttons properly. The downside to doing this is that firing events from JS means that they
are no longer "user-initiated", so mobile browsers will prevent things like onscreen keyboards
from appearing when focusing or clicking on a text field.
    By treating the `B` button as a `back` button, we can at least treat `keyCode` `0` events
as "select", and safely handle the `B` button separately as the `backbutton` event.

You can merge this pull request into a Git repository by running:

    $ git pull master

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #177
commit bbe333183d35f1d4f8a0b04eb224ca98ea4776b1
Author: Mathieu Bouchard <>
Date:   2015-05-29T21:12:29Z

    add gamepad a b x y buttons

commit c0c7eb25b2934c3d058a7077f36003996d07e660
Author: Mathieu Bouchard <>
Date:   2015-05-30T15:46:59Z

    remove gamepad button stuff and instead just treat B button as Back button


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message