Skip to content

Fix JoyCon triggers on the web#15816

Open
Nintorch wants to merge 1 commit into
libsdl-org:mainfrom
Nintorch:fix-joycon-triggers-web
Open

Fix JoyCon triggers on the web#15816
Nintorch wants to merge 1 commit into
libsdl-org:mainfrom
Nintorch:fix-joycon-triggers-web

Conversation

@Nintorch

Copy link
Copy Markdown
Contributor
  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

Description

This PR fixes JoyCon controller triggers detection in case they're in mini gamepad mode.
Previously they weren't detected because the browser reported having 2 real axes, while the SDL code expected to have at least 4.

The triggers still don't work correctly in Firefox, because they're detected as d-pad inputs, so I think that's a bug in the browser itself.

Existing Issue(s)

None

@slouken

slouken commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

This PR assumes that any controller with two axes will have trigger buttons, but that's not necessarily the case. I haven't tried it, but I can imagine an SNES controller falling into this code path. Do you have any other way of positively identifying this case?

@Nintorch

Copy link
Copy Markdown
Contributor Author

Hm, would it be acceptable to always have at least 6 axes and always read the trigger values from the buttons in case the mapping is standard, on both Chromium and Firefox? (and other browsers, of course)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants