fluid-lab / gamepad-navigator

GSoC 2020 project
Other
6 stars 10 forks source link

Allow "last focused controllable tab" to restore control when the user is not focused on a controllable window. #128

Open duhrer opened 7 months ago

duhrer commented 7 months ago

In #116, we made it harder to use the gamepad navigator to focus on a window/tab that cannot be controlled with the gamepad navigator. I realised earlier that our "page in view" check could be used to provide even more protection. Currently each page keeps track of whether it's in view and ignores inputs if it's not in view.

If instead we keep track of the last focused "controllable" window in our page focus code, then we have the option to allow the last focused "controllable" window to keep listening for gamepad inputs, and take action. Rather than scroll the page or perform the intended action, the last focused "controllable" window would bring the user back into control, in other words, back to the point where they can see responses to their gamepad inputs.

One option would be for the last controllable focused window to bring itself back into focus. Other options including opening the settings panel or an explanatory page.

duhrer commented 7 months ago

This would require some kind of persisted tracking of the last page in view that is viewable from all tabs. One option would be to have a global variable in the service worker. We could also use local storage.

duhrer commented 2 months ago

This is a prerequisite for #139, which I may evolve into a broader refactor.