jessebofill / DeckWebBrowser

A Decky Loader web browser plugin for the Steam Deck
GNU General Public License v3.0
15 stars 1 forks source link

Is there any information about what makes a webpage usable with controller? #3

Closed dancojocaru2000 closed 1 year ago

dancojocaru2000 commented 1 year ago

Most webpage show "Use touch", but not the Steam Store. Is there any information about what the Steam Store does to work work controller directly, and how other websites can do that too?

jessebofill commented 1 year ago

The websites themselves have to be made to support controllers. As you can see most websites aren’t designed with that in mind. There’s nothing the user/ I can do to change that.

dancojocaru2000 commented 1 year ago

I do get that, but I can't see what's different in the Steam Store website when I look over with inspect element besides some JS that doesn't seem to work on its own.

If I were to make my own webpage, what tells the Steam browser "this site can be used with a controller"?

jessebofill commented 1 year ago

There’s a gamepad api. https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API I’ve not used it so I can’t say much about it. But I’m assuming you have to code how button presses should be handled. And for things like directional inputs you’d have to write the logic to determine which elements are above/below/right/left of current focus/ which element should take focus, at least that’s what I’ve seen in valve’s code.

jessebofill commented 1 year ago

I’m also assuming there’s some way to tell the browser that “this site supports gamepad” but I have no idea how to do that. I just know from seeing in the code of steam decks built in browser that it checks whether the site supports gamepad and specifically there are different levels of support like partial/ full support.

jessebofill commented 1 year ago

I’m also assuming there’s some way to tell the browser that “this site supports gamepad” but I have no idea how to do that. I just know from seeing in the code of steam decks built in browser that it checks whether the site supports gamepad and specifically there are different levels of support like partial/ full support.

it actually looks like i was completely wrong about this. looking at the steam deck browser frontend code it has methods to check gamepad support that essentially just checking for window.bSupportsGamepadUI on the target window. this doesn't get set in the frontend so i don't know what they're actually checking in order to set support for a site. idk if they just do it on the steam website or what, because even on xbox cloud gaming site it doesn't get set. so honestly idk if it's possible to check if a site "supports" gamepad.

dancojocaru2000 commented 1 year ago

How odd. I did fake the Steam Deck user agent myself to get the Deck Store and poked around it and there is a script tag with window.bSupportsGamepadUI = 1;, but, when I hosted my own HTML file with that script tag, the browser still said "Use touch", so I thought that might be for something else.

Thanks for trying to figure it out!

jessebofill commented 1 year ago

How odd. I did fake the Steam Deck user agent myself to get the Deck Store and poked around it and there is a script tag with window.bSupportsGamepadUI = 1;, but, when I hosted my own HTML file with that script tag, the browser still said "Use touch", so I thought that might be for something else.

Thanks for trying to figure it out!

The browser is listening for specific messages for when to check that so they must be sending those messages in specific cases, although i cannot see where. Do you mind if i ask what specifically you're trying to do?