renpy / renpy-build

Build system for the Ren'Py visual novel engine. (The engine itself, not games.)
76 stars 51 forks source link

Prevent mobile browsers from refreshing page on scroll #94

Closed Kassy2048 closed 1 year ago

Kassy2048 commented 1 year ago

Fix https://github.com/renpy/renpy/issues/4991

It might be needed to set this CSS property to the "html" element as well (but not for Chrome on Android at least).

renpytom commented 1 year ago

Mdn says it should be on html, not body.

Kassy2048 commented 1 year ago

It did not work when I've added it to the html element only, but it did as soon as I've added it to the body element. Removing it from the html element did not change anything. My guess is it is needed on the html element only when the page is inside an iframe. I can add it to both if you think it makes more sense.

You can test it with the following URLs (scroll down to see if the page refreshes):

It only makes a difference with Chrome on Android, as Firefox does not seem to implement such a way to refresh the page.

Kassy2048 commented 1 year ago

It looks like Safari/Chrome on iOS needs that property set to the html element while Chrome on Android needs it to the body element. Also the property value was wrong because I misread the MDN explanations.

PoC is here.

renpytom commented 1 year ago

Tl;dr - @Kassy2048 is awesome, and the web sucks as much as ever.