4

I have a clickable sticky div at the bottom of the screen. It's CSS is as:

 .bottomFixed {
      position: fixed;
      height: 300px;
      bottom: 0;
      background-color: #CDDC39;
    }

You may check it out at https://s3.ap-south-1.amazonaws.com/github-charan/chrom-bug/index.html

You may see the recording of the issue at https://s3.ap-south-1.amazonaws.com/github-charan/chrom-bug/chrom-click-area-bug.mov

Expected: Upon scrolling the page on mobile, I expect this div to remain sticky and entire div should remain clickable.

Actual: This div does remain sticky. However, its clickable region changes. It shifts to top or bottom. Here is a screenshot:

enter image description here

This displacement of the clickable region is related to the presence of url bar. It is evident from logging that it occurs when resize event of window stops getting fired.

Also, till now we have observed it only with Chrome 67, Android.

How to reproduce it?

I have created a sample html to explain the problem. You may access it at:

https://s3.ap-south-1.amazonaws.com/github-charan/chrom-bug/index.html

Open this url on mobile. In the initial state, both the bars are sticky to the bottom. and, clicking anywhere on the bar, toggles their colour.

Now, Play with the page. Then, suddenly, the second bar is no more aligned with the footer. It shifts up or down. At this point click on the edges of first bar, its top or bottom area stops responding to clicks.

How to Debug it?

  1. Please connect your mobile using Remote Devices feature of Chrome Dev Tools.

  2. Click on the above url on mobile.

  3. Then, hover over the "bottomFixed" div in Elements Tab of Dev Tools.

  4. Now play with the screen. As you scroll, new window size is logged on the screen. When you tap anywhere on this div, it will display a console log message. Also, the colour of the div will toggle.

  5. Then, suddenly this logging stops, and hovered area shifts up or down. "topFixed" div does not remain sticky to the footer.

Now tap on the area outside the hovered region. It stops working!

Insights:

  1. Displacement height is equal to url bar.

  2. If in the initial paint, url bar was present i.e. when you land on the page directly, clickable region shifts up.

  3. and, if in the initial paint, url bar was absent i.e when you landed via navigation, clickable region shifts down.

  4. As window.resize does not get fired, pixel distance of the sticky div relative to the top does not change. However, the top itself is changed due to presence/absence of url bar.

  5. If we change the css to make this div sticky wrt to the top rather than bottom, as in the "topFixed" div, then this div also shifts along with the clickable region.

Please help solving this issue. It is a major bug on production. One quick and ugly fix is to disable the url bar movement. Reference: Prevent Address-Bar hiding in mobile Browsers

Charanjeet Kaur
  • 1,199
  • 3
  • 14
  • 27
  • Interesting finding. I tried your case here and I cannot find an answer. However, I can only reproduce it using two finger, one holding the scrolling screen and the second trying to click the div. In my case if I scroll and release, until then the resize event is fired and it fix the underlying areas. I do not want to use the mouse on the DevTools as it is not 100% the real user interaction. Also I will recommend toggle the color of the clicked div to be visual, easy to test without connecting the DevTools. – CarlosH. Jun 28 '18 at 17:16
  • @CarlosH. Thank you. I have made the changes in the sample html to toggle the colour upon click. Hoping to find a fix soon. – Charanjeet Kaur Jul 02 '18 at 12:02
  • @CharanjeetKaur We've encountered exactly the same problem. Still trying to find a fix. Because your question contains probably almost everything what is required to submit a bug, please just do it https://crbug.com/wizard – Dawid Karabin Jul 08 '18 at 13:53
  • Issue is already reported: https://bugs.chromium.org/p/chromium/issues/detail?id=848122, https://bugs.chromium.org/p/chromium/issues/detail?id=855694, probably related: https://bugs.chromium.org/p/chromium/issues/detail?id=790943, https://bugs.chromium.org/p/chromium/issues/detail?id=834054 – Dawid Karabin Jul 08 '18 at 14:05
  • So this still appears to be an issue despite having Chrome version 71 now. We are experiencing this issue on your website too, – BrokenCode Jan 29 '19 at 09:01

0 Answers0