Skip to content

fix(settings): fix controller indexing and detection in input settings - #1682

Open
vishalrao8 wants to merge 1 commit into
unknownskl:main-v2from
vishalrao8:fix/controller-gamepad-detection
Open

vishalrao8 wants to merge 1 commit into
unknownskl:main-v2from
vishalrao8:fix/controller-gamepad-detection

Conversation

@vishalrao8

@vishalrao8 vishalrao8 commented Sep 12, 2026

Copy link
Copy Markdown

🔗 Related Issues

🐛 The Bug

  • Sparse GamepadList & Runtime Crashes: In standard Web APIs, navigator.getGamepads() returns a GamepadList (not a standard JS Array) that often contains null entries for inactive slots.
  • Misaligned Slots: Calling .map() directly without array conversion and null filtering could throw runtime errors or misalign slot numbers (e.g., a controller in slot 2 being improperly mapped, or disconnected slots breaking the UI).

🛠️ What Changed

  • Safe Array Conversion: Converted navigator.getGamepads() using Array.from() to ensure proper array iteration across all environments.
  • Filter Active Controllers: Filters for valid, connected gamepads (item !== null && item.connected).
  • Normalized 4-Slot Layout: Iterates through slots Release 1.0.0 #1Bump eslint from 7.31.0 to 7.32.0 #4 with reliable fallback to "No controller detected" when slots are vacant.

- Convert navigator.getGamepads() to an array and filter by connected gamepads
- Render up to 4 controller slots with fallback when no controllers are connected
@vishalrao8
vishalrao8 force-pushed the fix/controller-gamepad-detection branch from 7c5122d to 9dd2cd5 Compare September 13, 2026 19:14
@sonarqubecloud

Copy link
Copy Markdown

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.

[Bug] No controller or keyboard input reaches the stream on macOS (M3 Pro) — controller detected as #2

1 participant