Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed element Y position calculated wrong after scroll on chrome for android

Happens when address bar becomes hidden/visible.

enter image description here

The element marked on the DOM explorer is the same element shown on the bottom of the screen (with the "Start Planning" button). After scroll it's actual location is being scrolled up (even though it is in fixed position), but no re-rendering occurs since it is still displayed on the screen in the correct position.

The interesting thing is that the element does not respond to clicks in the displayed area but rather in the DOM calculated area (aka, if you click above the button it works but not when you click on the button itself).

Here is the link the page on our platform that has the issue:

https://in-office.wekudo.com/wellness/category/nutrition/smoothie-bar

Same issue exists also on Airbnb's platform:

https://www.airbnb.com/rooms/select/17017021?search_id=74b85b09-c47b-4d33-854a-c42ffa1d7779&federated_search_id=93685a2b-81cc-49a4-9699-2e6adb1c1a25

like image 772
eyalhakim Avatar asked Jun 28 '18 10:06

eyalhakim


People also ask

How is scroll position calculated?

To get or set the scroll position of an element, you follow these steps: First, select the element using the selecting methods such as querySelector() . Second, access the scroll position of the element via the scrollLeft and scrollTop properties.

How do you make a Div fixed position while scrolling?

To make div fixed scrolling to that div with CSS, we can use the position: sticky CSS property. position: -webkit-sticky; position: sticky; top: 0; z-index: 1; to set position to sticky and z-index to 1 to make the element with the sticky position show on top after we scroll to it.

Which position get an element relative to scroll position in CSS?

An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.


2 Answers

The bug seems to be related to hammer.js:

https://github.com/hammerjs/hammer.js/issues/1171

like image 167
eyalhakim Avatar answered Sep 30 '22 06:09

eyalhakim


In CSS, please add overflow-y: visible !important;

like image 28
user9985211 Avatar answered Sep 30 '22 06:09

user9985211