New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 778366 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

CSS adding inline-block after render ignores top %

Reported by curtas...@gmail.com, Oct 25 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
1. https://jsfiddle.net/oru1uvr7/
<html>
	<body>
    <div style='height:555px;background:gray'>
      <div id=t style='position:relative;top:50%'>
        This text moves to the top when inline-block is added after render.
      </div>
    </div>
    <script>
      //document.getElementById('t').style.display='inline-block'//Text is centered if you do it this way.
      setTimeout(function(){document.getElementById('t').style.display='inline-block'}, 333)
    </script>
	</body>
</html>

2. Use code like this to make a container with fixed height and an inner div with position relative and the top is set to a percentage.
3. Add inline-block to the inner div after the page renders. With the dev tools or with javascript.

What is the expected behavior?
The text should stay vertically centered regardless of when/if you add inline-block. Compare to FireFox and Internet Explorer.

What went wrong?
The text moved to the top of the container.

Did this work before? N/A 

Chrome version: 61.0.3163.100  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 27.0 r0
 
Cc: divya.pa...@techmahindra.com
Labels: Triaged-ET M-64 PlatformDevtools Needs-Triage-M61 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on the reported chrome version 61.0.3163.100 and on the latest canary 64.0.3250.0 using Windows10, Ubuntu 14.04 and Mac 10.12.6. As the issue is seen M-50(50.0.2644.0), hence considering it as non-regression and marking it as untriaged.
Components: -Platform>DevTools Blink>CSS
Components: -Blink>CSS Blink>Layout
Labels: -PlatformDevtools
Status: Available (was: Untriaged)
Seems like possibly a layout issue. Feel free to ping it back if it's not.
Components: -Blink>Layout Blink>CSS
Actually I changed my mind. Putting it back under CSS.

Inspecting the div shows that with the first way of changing the display value 

document.getElementById('t').style.display='inline-block'

the computed value for top is 277.5px, and with the second way

setTimeout(function(){document.getElementById('t').style.display='inline-block'}, 333)

it's 9px.
Labels: Hotlist-Interop
Labels: Update-Quarterly
Components: -Blink>CSS Blink>Layout
Project Member

Comment 8 by sheriffbot@chromium.org, Nov 27

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment