position:sticky with display:inline-block is bugged
Reported by
sirvalen...@gmail.com,
Aug 26 2017
|
||
Issue descriptionChrome Version : 60.0.3112.113 (Windows) URLs (if applicable) : https://jsfiddle.net/h7hm4agj/4/ Other browsers tested: Firefox: OK Canary (62.0.3189.0): FAIL What steps will reproduce the problem? (1) Navigate to https://jsfiddle.net/h7hm4agj/4/ OR open the attached test.html in the browser directly (2) Scroll down inside the bordered div area where a pink square resides, so that the pink square sticks to the top as position:sticky obligates it. (3) Resize the browser window !horizontally!. (4) The pink square should have glitched out, jumping down in it's parent div. (5) When you scroll in the parent div now, the pink square should stay fixed in the position where it jumped when window resized, ignoring all scrolling actions. (6) To *fix* the pink square and restore it's original behavior scroll inside the parent back up to the top and resize the window again. The pink square should now jump to it's original location, and again behave like it is supposed to according to position:sticky. What is the expected result? Pink square should not jump around when a resize update happens, but continue on its duty as a display:sticky styled element. What happens instead? As stated above, it jumps down IF it is currently sticking to the top of it's parent AND the viewport is resized. Please provide any additional information below. Attach a screenshot if possible. Originally discovered for the <img> tag, where it would behave like the pink square in the example above. I supposed however, and it seems to be correct, that any element with display:inline-block would behave this way. The screenshot compilation of the bug is attached as pinksquare.png
,
Aug 30 2017
,
Nov 20 2017
This might be related. I have found the problem to occur on display: table-cell as well. Changing display to `grid` on the scrolling element fixes the issue. Here is a example showing the problem: https://codepen.io/anagrius/pen/GOQQqy
,
Apr 23 2018
Though it's funny this happens due to inline-block, I've seen similar issues in Firefox and safari, when (like here) the scrolling element is also the nearest block level ancestor for the sticky element to use as a containing block. If you wrap the contents inside another element effectively separating the 'scrollport' and the 'scrollbox' into two elements you can work around the bug. |
||
►
Sign in to add a comment |
||
Comment 1 by pnangunoori@chromium.org
, Aug 28 2017Components: Blink>Layout
Labels: -Type-Bug Needs-Triage-M60 hasbisect-per-revision M-62 OS-Linux OS-Mac OS-Windows Type-Bug-Regression
Owner: flackr@chromium.org
Status: Assigned (was: Unconfirmed)