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-align] should justify/align-self on abspos elements apply when offsets are 'auto'? #1429

Closed
dbaron opened this issue May 20, 2017 · 8 comments

Comments

@dbaron
Copy link
Member

dbaron commented May 20, 2017

The rules for justify-self on absolutely-positioned boxes and the rules for align-self on absolutely-positioned boxes both currently say that the property is ignored if either offset property in this dimension is auto.

First, this should be clearer that an "offset property" is top, right, bottom, or left or its logical equivalents (whatever we end up calling them).

However, this rule didn't match my expectation for how this property would behave in this case. I would have expected the rule to instead be that any auto values would be treated as 0, and then the property would apply. (It seems better to honor the thing the author asked for than to ignore it, especially when it's this simple!)

Was there a reason not to do this?

@dbaron dbaron added the css-align-3 Current Work label May 20, 2017
@dbaron
Copy link
Member Author

dbaron commented May 20, 2017

Note that doing this does require modifying the normal behavior to also be start rather than stretch when the self-end side offset is zero. (Or is it end-side rather than self-end-side???)

@dbaron
Copy link
Member Author

dbaron commented May 20, 2017

Or is the intent instead that the rules in the following sections on "Static Position of Absolutely-Positioned Boxes" apply instead? If so, maybe say that? (I'm still trying to understand what those rules mean.)

@dbaron
Copy link
Member Author

dbaron commented May 20, 2017

... though if that's the case, there are still some cases where there are some auto values but the static positioned isn't used, that fall through the gaps.

Also see #1432.

fantasai added a commit that referenced this issue Jun 26, 2017
…pending a reasonably stable spec that defines them properly). #1429
@tabatkins
Copy link
Member

Added another parenthetical to address the clarification issue...

Wrt treating a single auto as 0, we decided against it because it would be inconsistent with how auto margins behave, and also would break current behavior in at least some cases. For example, left: auto; width: 100px; right: 0; should right-align the abspos, but if we let justify-self apply it would get left-aligned (as the fallback for stretch). We could potentially make normal magical here, and let non-normal values apply by treating the lone auto as 0, but we try to have normal be as close to another equivalent value as possible.

More discussion of double-auto in #1432.

@dbaron
Copy link
Member Author

dbaron commented Jul 5, 2018

I think it would still be helpful to make "inset property" be a hyperlink so people know what it means.

I guess I have a somewhat different opinion of normal: I think what we're trying to do here is build a better set of alignment properties. So in the cases where the existing behavior is weird, it seems good to limit that weirdness to normal and have all the non-default values do more reasonable things. And in this case it seems pretty reasonable to honor the property in that case.

@css-meeting-bot
Copy link
Member

The Working Group just discussed issue 1429.

The full IRC log of that discussion <tantek> topic: issue 1429
<dbaron> github: https://github.com//issues/1429
<tantek> dbaron: one of the cases where I was disagreeing was in some ways some of these new properties are better than the old way of doing things, and I don't feel that strongly about this one, but there are some cases where it would be relatively simple to make these properties work in more cases, but it means making the 'normal' or whatever initial value do today's behavior
<tantek> dbaron: this one in particular is about justify self and align self on abs pos elements
<tantek> this is not static position stuff, this is actual absolute positioning
<tantek> dbaron: IDK maybe this is kinda the same as earlier
<tantek> fantasai: we discussed early j-s a-s on a abs pos element when ...
<tantek> TabAtkins: this is about one offset not being ...
<tantek> fantasai: per 2.1 the 2nd offset is computed after you compute the width
<tantek> TabAtkins: in other words like an auto margin
<tantek> fantasai: yeah
<tantek> dbaron: my perspective, i've never particularly liked auto margins as a mechanism, and these properties ought to override them
<tantek> fantasai: specific examples?
<tantek> dbaron: e.g. ...
<tantek> dbaron: maybe it's ok, I'm ok with this one, but I've kinda forgotten what we resolved here
<tantek> dbaron: I'm ok with it
<tantek> dbaron: there was one other one I thought was worth discussing, and I need to find the list of issues again
<tantek> end topic

@tabatkins
Copy link
Member

We ended up realizing that you were right, and that static position of abspos elements should be affected by justify/align-self. This is now reflected in https://drafts.csswg.org/css-align-3/#abspos-sizing for sizing the element, and https://drafts.csswg.org/css-align-3/#align-abspos (with details in https://drafts.csswg.org/css-align-3/#static-position-rectangle) for positioning.

This was all done as part of #1432. Does this satisfy your concerns?

@fantasai
Copy link
Collaborator

fantasai commented Dec 7, 2018

No response in nearly three months, and also no response to multiple queries of "did you want to review this issue", so closing out as timed out.

@fantasai fantasai closed this as completed Dec 7, 2018
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

5 participants