Re: [w3c/gamepad] gamepadconnected/disconnected events & non-"fully active" documents (#149)

Looking at the [current spec](https://w3c.github.io/gamepad/#event-gamepadconnected), it looks like the events won't be dispatched to BFCached (non-fully-active) documents which might cause confusion. 

I think we can modify the spec like this
- Add state tracking that saves whether a gamepad is currently connected / disconnected as `currentState`.
- Save the `currentState` just before navigating to `stateBeforeNavigation` (either by listening to changes to the "fully active" state adding to "[unloading document cleanup steps](https://html.spec.whatwg.org/#unloading-document-cleanup-steps)")
- When the document becomes "fully active" again, check if the `currentState` is different from `stateBeforeNavigation`, and dispatch the appropriate event. 

@ Gamepad people, WDYT?
(There's also the [TAG Design Principles doc](https://w3ctag.github.io/design-principles/#support-non-fully-active) for common patterns in case it's needed)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/issues/149#issuecomment-1157711522
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/gamepad/issues/149/1157711522@github.com>

Received on Thursday, 16 June 2022 14:15:32 UTC