This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Order in which index entries should be reused is unspecified. The description of the index property on Gamepad states: "if a gamepad is disconnected, and subsequently the same or a different gamepad is then connected, index entries must be reused." So if I have 2 gamepads, then disconnect index 0, then connect a new gamepad, it should reuse index 0. If I have 3 gamepads, then disconnect index 1, then connect a new gamepad, it should reuse index 1. But what if I have 3 gamepads, disconnect index 1, then disconnect index 0. Then connect a new gamepad. Which index should it reuse? 0, which is the lowest unused index? Or 1, because it was the first disconnected index? I would say 0, and suggest the spec state something like: "if a gamepad is disconnected, and subsequently the same or a different gamepad is then connected, the lowest previously used index must be reused."
Your suggestion is what Firefox implements (and I'm fairly certain Chrome), and is certainly the intended behavior.
Moved to https://github.com/w3c/gamepad/issues/11