New issue
Advanced search Search tips

Issue 856448 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 841551
Owner: ----
Closed: Dec 10
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Negative margin causes sticky positioned elements to render at incorrect position on screen

Reported by wb...@box.com, Jun 26 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce the problem:
http://next.plnkr.co/edit/7eXQu5s2pQEjaa4b (same as the attached file)

If the top value is consistent with the negative margin then the rendered position is reconciled with the clickable region, but it incorrectly scrolls beyond the expected region, which is inconsistent with observed behavior on Firefox.

What is the expected behavior?
The clickable region should never deviate from the rendered element

What went wrong?
The element is drawn offset from where it actually exists on the page. This inconsistency can be viewed via the Element's tab in the Developer Tools pane. This behavior appears correct in Firefox, although the interaction between top, a negative top-margin, and position sticky is still strange.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 67.0.3396.99  Channel: stable
OS Version: OS X 10.11.6
Flash Version: 

How position sticky interacts with negative margins is not well documented.
 
repro.html
1.2 KB View Download

Comment 1 by gov...@chromium.org, Jun 26 2018

Cc: pbomm...@chromium.org
Labels: Needs-Triage-M67
Labels: Triaged-ET M-69 Target-69 FoundIn-69
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Mac 10.13.3 using chrome reported version #67.0.3396.99 and latest canary #69.0.3472.3. Issue is specific to OS-mac.
This is a non-regression issue as it is observed from M60 old builds. 

Hence, marking it as untriaged to get more inputs from dev team.

Thanks...!!

Comment 3 by e...@chromium.org, Jun 28 2018

Cc: -pbomm...@chromium.org flackr@chromium.org
Components: -Blink>CSS Blink>Scroll
Over to flackr for position sticky triage.
Actually their is still compat issues with firefox and negative top margin... I added to the original testcase a wee bit to see how all 3 browsers behave differently. Primarily by making the header not fully opaque, so you can see how the content alongside the sticky header behaves.

http://next.plnkr.co/edit/QkTDlr9FRKxijejC

I also added a second scroller that has the padding not on the scrolling element, but on a wrapper element inside the scroller. Notice how this padding changes effect firefox compared the chrome/safari. This may be due to the age old https://github.com/w3c/csswg-drafts/issues/129.
To be clear the compat issue is not my primary concern. Yes, there are subtle differences between how the sticky positioned elements are rendered/scrolled in relation to padding/margin. I'd prefer to avoid pinning this ticket to that problem.

My primary concern is that the elements interactable/clickable region becomes inconsistent with where it is actually rendered on screen in Blink. If you view your plunkr in Firefox both the left and right submit buttons' interact regions match their rendered element. n Chrome the left submit button becomes inconsistent while the right button remains consistent.
Cc: majidvp@chromium.org
Status: Available (was: Untriaged)
I can see the issue as well. CC'ing more folks who are more expert in this area for triaging.
The Chrome issue seems to be related in a difference of behavior in out main thread and compositor thread position sticky path.


On my linux box, I can repro the issue if I force the <div class='main'> to be composited [1]. Doing so, puts the sticky element at a different position. Our main thread implementation 
behavior matches the Firefox. See attached screenshots.

More importantly the fact that compositor calculated position is different from main thread, results in incorrect hit-testing as pointed out by the original report.

I am not going to guess wether main offset calculation is correct or not but regardless
we need to ensure out compositor code path computes the same offset as main.




[1] e.g. by adding  'backface-visibility: hidden;'

main-sticky.png
148 KB View Download
compositor-sticky.png
93.8 KB View Download
Cc: smcgruer@chromium.org yigu@chromium.org
/cc yigu@ and smcgruer@ who have worked on stick code most recently.

BTW, if you want to see something **fun** use larger negative margins when container is composited.
Labels: OS-Android OS-Chrome OS-Linux OS-Windows
Seems like this could have been inadvertently *fixed, as the broken behavior I used to see in the test case is now gone.
Mergedinto: 841551
Status: Duplicate (was: Available)
Right. It was fixed in  issue 841551 .

Sign in to add a comment