[css-text] text-align-last: match-parent; is not well defined · Issue #7331 · w3c/csswg-drafts · GitHub
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-text] text-align-last: match-parent; is not well defined #7331

Closed
nt1m opened this issue Jun 1, 2022 · 6 comments
Closed

[css-text] text-align-last: match-parent; is not well defined #7331

nt1m opened this issue Jun 1, 2022 · 6 comments
Labels
Closed Accepted as Obvious Bugfix Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-text-3 Current Work

Comments

@nt1m
Copy link
Member

nt1m commented Jun 1, 2022

It's not clear what text-align-last: match-parent should do from a web developer perspective, and also ambiguous how this should work on the :root element. Can this be clarified in the spec?

@nt1m
Copy link
Member Author

nt1m commented Jun 1, 2022

Fwiw, no browser supports text-align-last: match-parent.

@fantasai Do you know where this was added?

@Loirooriol
Copy link
Contributor

Isn't this defined in https://drafts.csswg.org/css-text/#valdef-text-align-match-parent ?

This value behaves the same as inherit (computes to its parent’s computed value) except that an inherited value of start or end is interpreted against the parent’s (or the initial containing block’s, if there is no parent) direction value and results in a computed value of either left or right.

The behavior would be like for text-align-all, but for the last line.

@nt1m
Copy link
Member Author

nt1m commented Jun 2, 2022

Isn't this defined in https://drafts.csswg.org/css-text/#valdef-text-align-match-parent ?

This value behaves the same as inherit (computes to its parent’s computed value) except that an inherited value of start or end is interpreted against the parent’s (or the initial containing block’s, if there is no parent) direction value and results in a computed value of either left or right.

The behavior would be like for text-align-all, but for the last line.

That's for text-align. What is the parent of the last-line? Also it doesn't explain why the computed value of match-parent is as specified for text-align-last, but not text-align (where match-parent computes to left/right).

@Loirooriol
Copy link
Contributor

That's for text-align.

But in the spec text-align is a shorthand, so text-align: match-parent just sets text-align-all: match-parent and text-align-last: match-parent. Defining values in shorthands seems confusing to me, but it also happens e.g. in https://drafts.csswg.org/css-overflow/#propdef-overflow

What is the parent of the last-line?

It's not the parent of the last line. If the block container is element-generated, then it's the parent element of the element that generates that block container. If it's anonymous, it's the parent box of the block container (see https://drafts.csswg.org/css-display-3/#anonymous).

The root element has no parent. So the inherited value is the initial value, start, which is then resolved using the direction of the initial containing block, which per https://drafts.csswg.org/css-display-3/#containing-block is the direction of the root element itself. Not sure if this is the computed or the used value, which may be different due to https://drafts.csswg.org/css-writing-modes-4/#principal-flow. Whatever happens, it should be analogous for text-align-all and text-align-last.

Also it doesn't explain why the computed value of match-parent is as specified for text-align-last, but not text-align

Yeah, I guess text-align-last should also say "Computed value: keyword as specified, except for match-parent which computes as defined above".

@fantasai
Copy link
Collaborator

@nt1m Given Oriol's explanations and the edits, do we need any further edits here?

@nt1m
Copy link
Member Author

nt1m commented Jul 31, 2024

Sounds good.

@nt1m nt1m closed this as completed Jul 31, 2024
@frivoal frivoal added Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Commenter Response Pending labels Jul 31, 2024
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-text-3 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants