Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-2][css-position-3] Absolutely positioned boxes in inline relatives: not interoperable #609

Closed
FremyCompany opened this issue Oct 15, 2016 · 6 comments

Comments

@FremyCompany
Copy link
Contributor

CSS 2.2 leaves this behavior undefined:

If the direction is ltr, the top and left of the containing block are the top and left content edges of the first box generated by the ancestor, and the bottom and right are the bottom and right content edges of the last box of the ancestor.
http://www.w3.org/TR/CSS22/visudet.html#containing-block-details

CSS Position 3 says "top,left" are relative to the first fragment, and "bottom,right" the last.

In CSS 2.2, if the inline element is split across multiple lines, the containing block is undefined.
https://drafts.csswg.org/css-position-3/#def-cb

Testcases

https://jsfiddle.net/pu494kg8/ (rtl)
https://jsfiddle.net/pu494kg8/1/
https://jsfiddle.net/pu494kg8/2/ (ltr)
https://jsfiddle.net/pu494kg8/3/
https://jsfiddle.net/pu494kg8/4/

  • ltr: Edge and Chrome consider "right" to be the left of the first fragment.
  • ltr: Firefox considers "bottom" and "right" to be the bottom/right of the first fragment.
  • rtl: Implementations are not interoperable at all.

I recommend we change the spec to match Edge/Chrome behavior for ltr (and mirror it for rtl), except if we intend to fix. I am not willing to have us move away from the Webkit/Blink behavior if we don't have a clear signal promising a fix for at least one of those, given the compat risks.
Thoughts?

// cc: @atanassov @fantasai @tabatkins @grorg @dbaron

@FremyCompany
Copy link
Contributor Author

Resolved to continue discussion on github in today's call

@dbaron
Copy link
Member

dbaron commented Nov 8, 2016

I wrote some testcases.

I'm happy to standardize on the Edge behavior, which I believe matches Chrome for ltr, and does the equivalent for other directions (whereas Chrome does different and sometimes bizarre things for other directions).

In particular, as I understand it, that behavior is:

  • form a containing block from the block-start and inline-start padding-box edges of the first fragment and the block-end and inline-end padding-box edges of the last fragment
  • If that containing block has a negative width or height, turn each negative width or height into 0 by keeping the edge (in that dimension) that came from the first fragment the same, and changing the edge that came from the last fragment to be equal to the edge from the first fragment

I'd note that I didn't thoroughly test different sorts of overlap situations. However, I haven't seen any places Edge deviates from the above description (with EdgeHTML 14.14393).

@FremyCompany
Copy link
Contributor Author

FremyCompany commented Nov 9, 2016

Now that it is described in that way, I am even more in favor of clarifying the spec to match our implementation (and therefore Chrome in the left-to-right case). It actually makes sense.

@atanassov
Copy link
Contributor

CSSWG RESOLUTION: Accept Edge and Chrome in the LTR case as the proposed behavior as explained by @dbaron above.

@bfgeek
Copy link

bfgeek commented Dec 14, 2016

@eaenet and I were just talking about this. We may need to tighten the wording further for when we fragment in the block direction. For example:

<style>
.container {
  column-count: 2;
}
</style>
<div class=container>
<span class=cb>
<span class=abs1></span>
  text which spans<!-- column break --> over two columns.
<span class=abs2></span>
</span>
</div>

In the above example two fragments are produced.

  1. "text which spans"
  2. "over two columns"

Which fragment should the .abs1 and .abs2 elements "anchor" to?

I think anchoring to the fragment which would have contained the absolute child if it wasn't out of flow makes the most sense?

@bfgeek
Copy link

bfgeek commented Dec 14, 2016

I forgot to add - in the multicol case, what is top and bottom based off for both .abs1 and .abs2?

tabatkins added a commit that referenced this issue Jan 6, 2023
@fantasai fantasai closed this as completed Jan 6, 2023
jakearchibald pushed a commit to jakearchibald/csswg-drafts that referenced this issue Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants