- From: Marcos Cáceres <notifications@github.com>
- Date: Mon, 16 Nov 2026 19:05:43 -0800
- To: w3c/gamepad <gamepad@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/gamepad/pull/196/review/5932087452@github.com>
@marcoscaceres commented on this pull request.
@xingri, the steps that set the type cannot run as written, so most of these comments are about that algorithm. Five of the six comments are suggestions you can apply as they are, and the sixth is a question. This branch also conflicts with gh-pages now, so it needs a rebase.
> + <li>Let |type| be the result of determining if the button at index |rawInputIndex|
+ [=represents a Standard Gamepad button=] or represents a [=additional gamepad button=].
+ If it's neither, use {{GamepadButtonType/"non-standard"}}.
+ </li>
+ <li>If |type| is not {{GamepadButtonType/"non-standard"}}:
Please drop `|type|` from this loop. Nothing says what value `|type|` gets, a trackpad button passes the "not non-standard" test and then needs a canonical index that only Standard Gamepad buttons have, and `|type|` is out of scope in the last loop anyway. This suggestion restores the original test, so a trackpad button takes the "Otherwise" path and gets the next free index. The next suggestion sets each type where the button is created.
```suggestion
<li>If the gamepad button at index |rawInputIndex| [=represents a Standard Gamepad button=]:
```
> + <li>Let |button:GamepadButton| be a [=new=] {{GamepadButton}} with its
+ |button|.{{GamepadButton/pressed}} initialized to `false`,
+ |button|.{{GamepadButton/touched}} initialized to `false`,
+ |button|.{{GamepadButton/type}} initialized to |type|, and
+ |button|.{{GamepadButton/value}} initialized to 0.
+ </li>
This works out each button's type where the button is created, so every button has a value and `|type|` is in scope. A standard slot that no input fills, and a second input at the same standard position, both get "non-standard". The "non-standard" description says the button exists, so it needs a sentence for these two cases, or they need another value. This suggestion needs the "represents a trackpad button" definition that a later suggestion adds.
```suggestion
<li>Let |type| be {{GamepadButtonType/"non-standard"}}.
</li>
<li>[=map/For each=] |rawInputIndex| → |mappedIndex| of |gamepad|.{{Gamepad/[[buttonMapping]]}}:
<ol>
<li>If |mappedIndex| is |buttonIndex|:
<ol>
<li>If the gamepad button at index |rawInputIndex| [=represents a Standard Gamepad button=] and its [=canonical index=] is |buttonIndex|, set |type| to {{GamepadButtonType/"standard"}}.
</li>
<li>Otherwise, if the gamepad button at index |rawInputIndex| [=represents a trackpad button=], set |type| to {{GamepadButtonType/"trackpad"}}.
</li>
</ol>
</li>
</ol>
</li>
<li>Let |button:GamepadButton| be a [=new=] {{GamepadButton}} with its
|button|.{{GamepadButton/pressed}} initialized to `false`,
|button|.{{GamepadButton/touched}} initialized to `false`,
|button|.{{GamepadButton/type}} initialized to |type|, and
|button|.{{GamepadButton/value}} initialized to 0.
</li>
```
> + An enumerated {{GamepadButtonType}} attribute that classifies the current button's type in relation to an
+ extended mapping.
The other three attributes say what reading them returns. This one does not. This suggestion adds getter steps that return the type the button was created with, as I asked in April 2024. No internal slot is needed, since the value never changes.
```suggestion
An enumerated {{GamepadButtonType}} attribute that classifies the current button's type in relation to an
extended mapping.
<p>
The {{GamepadButton/type}} getter steps are:
</p>
<ol>
<li>Return the {{GamepadButtonType}} that [=this=] was initialized with.
</li>
</ol>
```
> @@ -2447,6 +2467,60 @@ <h2>
Visual representation of a [=Standard Gamepad=] layout.
</figcaption>
</figure>
+ <section>
+ <h3>
+ <dfn>Additional gamepad buttons</dfn>
+ </h3>
+ <p>
+ This section introduces an extended gamepad button mapping beyond the [=Standard Gamepad=] mapping.
+ These additional buttons are commonly found on certain gamepad models.
+ Some examples of these additional buttons include trackpads or touchpads, share or capture buttons,
+ voice assistant buttons, home buttons, and various squeeze buttons.
A home button in the center of a controller sits where Standard Gamepad index 16 is, the center button of the center cluster. This list calls home buttons additional, so one button could count as both standard and additional. This suggestion removes "home buttons" from the list. If you want to keep them, please say which test wins.
```suggestion
voice assistant buttons, and various squeeze buttons.
```
> + Consequently, the number of buttons on the {{Gamepad}} is not limited to the standard mapping of 17 buttons.
+ </p>
The suggestion on the button-creation step uses "represents a trackpad button", which the text does not define yet. This suggestion defines it with a test, like the one for Standard Gamepad buttons, so two implementations give the same answer. Other additional buttons, such as share or squeeze buttons, get "non-standard".
```suggestion
Consequently, the number of buttons on the {{Gamepad}} is not limited to the standard mapping of 17 buttons.
</p>
<p>
A button input <dfn>represents a trackpad button</dfn> if it reports the click of a trackpad or touchpad.
A trackpad button is one of the [=additional gamepad buttons=].
</p>
```
> + <p>
+ This enum defines the set of possible button types.
+ </p>
+ <pre class="idl">
+ enum GamepadButtonType {
+ "non-standard",
+ "standard",
+ "trackpad",
+ };
+ </pre>
+ <dl data-dfn-for="GamepadButtonType">
+ <dt>
+ "<dfn>standard</dfn>"
+ </dt>
+ <dd>
+ Represent a button has a button type defined in the [=Standard Gamepad=] mapping.
"standard" is described as being in the Standard Gamepad mapping, but the algorithm decides it by where the button sits and never reads the gamepad's mapping value. As written, a gamepad with mapping "" could still get "standard" buttons. The suggestion on the button-creation step also gives "non-standard" to a second input at the same standard position, which this sentence would call standard. Should "standard" follow the mapping value or the button's position? Please say which.
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/196#pullrequestreview-5932087452
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/gamepad/pull/196/review/5932087452@github.com>
Received on Tuesday, 17 November 2026 03:05:47 UTC