DIM icon indicating copy to clipboard operation
DIM copied to clipboard

Scroll Body Lock not working in Chrome

Open kyleshay opened this issue 5 years ago • 8 comments

What Browser and OS are you using? Chrome-based (Android or Desktop)

Describe the bug and how to make it happen When I tap an item and view the item details, I'm able to swipe up and down on the Sheet and move the inventory behind it. This is an issue when swiping to close the Sheet. Swiping down closes the sheet, but it also scrolls you to the top of the page.

foo

kyleshay avatar Aug 19 '20 23:08 kyleshay

Did this start recently?

bhollis avatar Aug 20 '20 06:08 bhollis

not exactly sure. https://github.com/DestinyItemManager/DIM/issues/5547 leads me to believe that it is at least that old (user scrolling behind the sheet to add items)

kyleshay avatar Aug 20 '20 07:08 kyleshay

FYI this is just for the item popup, other sheets lock as expected.

kyleshay avatar Aug 26 '20 04:08 kyleshay

Interesting - scroll lock is handled by Sheet, not the popup, which makes me think some CSS is maybe overriding something?

bhollis avatar Aug 26 '20 06:08 bhollis

It seems that the background never locks on Android, you can always tap and scroll it— though that's fine (almost even preferred? — on iOS the background is totally locked.)

The main issue is that when you're touch-dragging on the sheet, the background shouldn't move. Seems like anywhere on the header the body locks, and anywhere in the horizontal scroll area it locks. Weirdly just doesn't lock where the stat names are on the far left.

https://user-images.githubusercontent.com/424158/147706161-22024dc6-d7a2-421a-920b-5b256e60fb96.mp4

kyleshay avatar Dec 29 '21 21:12 kyleshay

I think I have an idea. The sheet is supposed to block touch events from bubbling out of the sheet itself, but chrome changed to automatically convert touchstart events to passive even if you didn't register them that way. So perhaps we need to register them ourselves with passive: false.

bhollis avatar Dec 30 '21 15:12 bhollis

Ooh hmm good call—just tried sheetContents.current.addEventListener('touchstart', blockEvents, { passive: false }); in Sheet.tsx to no avail :(

kyleshay avatar Dec 30 '21 18:12 kyleshay

I'm not able to reproduce this on Android, though maybe I'm not following the correct steps? I'm running a WebView with Chromium v125. I am able to scroll the body underneath the overlay directly, but that seems to be different than what is being reported here.

https://github.com/DestinyItemManager/DIM/assets/2721089/376896b2-dee0-441b-a3d8-65bf1af7a196

Worth noting that I reported a similar issue to the Chromium team earlier this year. However, given that the issue in DIM dates back to 2020 I'm not sure these are exactly the same.

liamdebeasi avatar Jun 13 '24 01:06 liamdebeasi