Re: [w3c/gamepad] Spec gamepad input events (PR #234)

@gabrielsanbrito commented on this pull request.



> @@ -839,6 +841,29 @@ <h3>
               </li>
             </ol>
           </li>
+          <li>Let |oldGamepad:Gamepad| be the state of the device represented

Done. I also realized that we don't need to keep checking if |oldGamepad| is null as it will never be. Since |gamepad| gets populated when the device is connected, by the time that we run the "Receiving inputs" steps, |gamepad| will never be `null`.  

> @@ -787,6 +787,17 @@ <h3>
           following steps:
         </p>
         <ol>
+          <li>Let |navigator:Navigator| be |gamepad|'s [=relevant global
+          object=]'s {{Navigator}} object.
+          </li>
+          <li>Let |document:Document?| be |gamepad|'s [=relevant global
+          object=]'s [=associated `Document`=]; otherwise `null`.
+          </li>
+          <li>If |document| is `null`, abort these steps.
+          </li>
+          <li>If |document| is not [=allowed to use=] the [=policy-controlled
+          feature=] named "gamepad", then abort these steps.
+          </li>

Rewrote the document check line to be:
```
"If |document| is `null` or not [=Document/fully active=], abort these steps"
```

> @@ -1006,6 +1031,109 @@ <h3>
             </ol>
           </li>
         </ol>
+        <p>
+          To <dfn>detect gamepad input changes</dfn> between |gamepad1:Gamepad|
+          and |gamepad2:Gamepad|, run the following steps:
+        </p>
+        <ol class="algorithm">
+          <li>Assert: |gamepad1| and |gamepad2| are not `null`.
+          </li>
+          <li>If [=list/size=] of |gamepad1|.{{Gamepad/[[axes]]}} is not equal

Also fixed for buttons and touches.

> @@ -1006,6 +1031,109 @@ <h3>
             </ol>
           </li>
         </ol>
+        <p>
+          To <dfn>detect gamepad input changes</dfn> between |gamepad1:Gamepad|
+          and |gamepad2:Gamepad|, run the following steps:
+        </p>
+        <ol class="algorithm">
+          <li>Assert: |gamepad1| and |gamepad2| are not `null`.
+          </li>
+          <li>If [=list/size=] of |gamepad1|.{{Gamepad/[[axes]]}} is not equal
+          to the [=list/size=] of |gamepad2|.{{Gamepad/[[axes]]}}, return
+          `true`.
+          </li>
+          <li>[=list/For each=] |axisIndex:long| of

It is unexpected that [=list/indices=] resolve, but [=list/index=] doesn't. I modified here to be:
```
[=list/For each=] index |axisIndex| of |gamepad1|.{{Gamepad/[[axes]]}}
```

Also applied the edit to buttons and touches.

> +          <li>[=list/For each=] |axisIndex:long| of
+          |gamepad1|.{{Gamepad/[[axes]]}}'s [=list/indices=]:
+            <ol>
+              <li>If |gamepad1|.{{Gamepad/[[axes]]}}[|axisIndex|] is not equal
+              to |gamepad2|.{{Gamepad/[[axes]]}}[|axisIndex|], return `true`.
+              </li>
+            </ol>
+          </li>
+          <li>If [=list/size=] of |gamepad1|.{{Gamepad/[[buttons]]}} is not
+          equal to the [=list/size=] of |gamepad2|.{{Gamepad/[[buttons]]}},
+          return `true`.
+          </li>
+          <li>[=list/For each=] |buttonIndex:long| of
+          |gamepad1|.{{Gamepad/[[buttons]]}}'s [=list/indices=]:
+            <ol>
+              <li>Let |button1:GamepadButton| be equal to

Done. Also fixed the issue for touches

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/234#discussion_r4253526797
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/gamepad/pull/234/review/5497105095@github.com>

Received on Tuesday, 13 October 2026 01:00:53 UTC