Skip to content

[cssom] Sticky position percentage values for inset properties. #3115

@emilio

Description

@emilio

Consider the test-case:

<!doctype html>
<div id="log"></div>
<div style="height: 500px; background: purple; overflow: hidden;">
  <div style="height: 400px; background: yellow;">
    <div id="target" style="height: 100px; position: -webkit-sticky; position: sticky; left: 0; top: 50%; background: blue;">
    </div>
  </div>
</div>
<script>
  log.innerHTML = getComputedStyle(target).top;
</script>

Every browser resolves the percentage during layout relative to the overflow: hidden container (that is, the closest scrollable box), so #target is positioned 250px from the top.

However, every browser except Gecko resolves the percentage in getComputedStyle against the containing block (the yellow box), returning 200px instead.

I think I should file bugs against the other browsers and clarify the spec because those percentages make no sense, but I'm not sure if I'm missing something...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions