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-position-3] Coordinates of Containing Blocks of Positioned Boxes from Inline Boxes with Mixed Bidi Direction Text Content are Unclear #7917

Closed
bernhardf-ro opened this issue Oct 19, 2022 · 5 comments
Labels
Closed Accepted as Obvious Bugfix Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-position-3 Current Work

Comments

@bernhardf-ro
Copy link

"css-position-3: 2.1. Containing Blocks of Positioned Boxes" says:

If the ancestor is an inline box, the containing block is formed by the block-start and inline-start content edges of the first box fragment of the ancestor, and the block-end and inline-end content edges of the last box fragment of the ancestor.

When taking into account bidi (see "css-writing-modes-3: 2.4.5. Reordering-induced Box Fragmentation") it is unclear whether first and last are meant logically or visually.

While we consider visual the only useful and expected interpretation in this case, we normally would assume logical when nothing is specified.

Chrome and Firefox have different interpretations:

Source:

<p dir="rtl"><span style="position: relative;">abc&#x5d0;def<span style="position: absolute; left: 0; top: 0; bottom: 0; border-left: 0.1em solid red"></span></span></p>

Chrome (visual):
image

Firefox (logical):
image

This also demonstrates how unexpected the logical version is.

Whether extending the paragraph is enough or the processes requires more detailed specification we are not sure.

@fantasai fantasai added the css-position-3 Current Work label Nov 16, 2022
@fantasai
Copy link
Collaborator

Thanks, this looks like an error in translating the spec from CSS2. The correct definition is this one: https://www.w3.org/TR/CSS2/visudet.html#containing-block-details

@bernhardf-ro
Copy link
Author

Is there a specific reason to not go for the bounding box of all inline boxes of the element?
In the inline direction it would make sure exactly the full visual width is covered, no matter how the boxes are ordered, e.g. through bidi.
In the block direction it also would lead to more consistent results, again avoiding unexpected behavior due to things like bidi.

@tabatkins
Copy link
Member

Is there a specific reason to not go for the bounding box of all inline boxes of the element?

Yes, there is. If the first fragment is a small portion at the end of a line, for example, then positioning yourself at the start/start corner of the bounding box will cause you to position in an unrelated area, not next to any fragment of the actual inline.

The edits we just pushed do clarify that when there are multiple fragments on the first/last line, you take the visually first/last one (for the reasons you gave in the original comment).

That said, it doesn't appear to be super well-defined what it means if the edges of a containing block are in the wrong order, so we're raising that as a separate issue.

@fantasai
Copy link
Collaborator

fantasai commented Jan 6, 2023

Filed issue about multi-line containing blocks here: #8284

@bernhardf-ro
Copy link
Author

Thanks for elaborating.
The edit looks good to us.
We will have a look at #8284 and give feedback later.

jakearchibald pushed a commit to jakearchibald/csswg-drafts that referenced this issue Jan 16, 2023
@fantasai fantasai added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted as Obvious Bugfix Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-position-3 Current Work
Projects
None yet
Development

No branches or pull requests

3 participants