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-anchor-position] Default alignments for inset areas are wrong #10313

Closed
fantasai opened this issue May 13, 2024 · 3 comments
Closed

[css-anchor-position] Default alignments for inset areas are wrong #10313

fantasai opened this issue May 13, 2024 · 3 comments

Comments

@fantasai
Copy link
Collaborator

(I thought we had already edited this in, but apparently not...)

The current resolution of normal alignment is defined as follows:

  • If the inset area includes the center region in an axis the default alignment in that axis is anchor-center
  • Otherwise, it’s the opposite of the region it specifies: if it’s specifying the "start" region of its axis, the default alignment in that axis is end.

But actually it should be:

  • If the inset-area is a side track, then the alignment is towards the center track (i.e. in the opposite direction of the named track).
  • If the inset-area is the center track, or all tracks, then alignment is anchor-center.
  • If the inset-area includes the center track and a side track, then alignment is towards the excluded track.

This behavior for the double tracks gets you the correct behavior for more cases, and is easier to switch to the other common behavior (centering) because centering isn't conditional on which area you're in.

@tabatkins
Copy link
Member

(Just to be clear, the first two bullet points (in the second group listed above) are current spec behavior; it's the third, covering span-* keywords, that's different.)

It turns out that the Chrome impl already does what you're requesting, rather than what I wrote in the spec. I'm happy to update the spec to match; I agree it's better. Here's an example.

(IIRC, the current behavior for a span-* value was written when anchor-center automatically "un-aligned" for overflow, which resulted in a similar behavior to what you're suggesting. I just didn't revisit this when the sliding behavior was deferred; it definitely needs to be changed.)

Do you think we need a resolution for this, or are you okay with just an edit?

@frivoal
Copy link
Collaborator

frivoal commented May 15, 2024

I think a resolution would be helpful. This is a change for the better, but it's a change.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-anchor-position] Default alignments for inset areas are wrong, and agreed to the following:

  • RESOLVED: If inset-area spans both of the tracks we'll align toward the missing track instead of centering
The full IRC log of that discussion <emilio> fantasai: initial value for align/justify-self is normal
<emilio> ... generally depends on context to an appropriate behavior
<emilio> ... for inset-area we try to make the default alignment for the area useful
<emilio> ... so if you're in the center track we center
<emilio> ... if you're on the edge we align toward the area
<emilio> ... if you're spanning into two tracks
<emilio> ... and there the default is anchor-center, but that's generally not what you want
<kizu> q+
<emilio> ... the usual thing is to align towards the track you're excluding
<emilio> ... it's easy to center if needed
<TabAtkins> q+
<astearns> ack kizu
<emilio> kizu: tested r/n, I think it works well when the anchor is smaller than the positioned element
<emilio> ... when the anchor is bigger it looks better with anchor-center
<emilio> fantasai: typically in that case you keep aligned to one edge and overflow
<emilio> kizu: can we define anchor-center to try not to shrink to the center area
<emilio> ... only if it's not fitting shifted it'd work better
<emilio> TabAtkins: tracked on a different issue
<emilio> ... not on the agenda this week
<astearns> ack TabAtkins
<emilio> kizu: no objection then
<emilio> TabAtkins: no objection from us either
<emilio> ... what kizu described was the originally what I wanted
<emilio> ... but I deferred the shifting
<emilio> ... because I wanted to fix it more generally
<emilio> ... so tldr agree with the change
<emilio> ... also our impl actually matches that resolution because engineers misread the conditions
<emilio> PROPOSED: If inset-area spans both of the tracks we'll align toward the missing track instead of centering
<emilio> RESOLVED: If inset-area spans both of the tracks we'll align toward the missing track instead of centering
<TabAtkins> s/both of the/two/

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