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-3] safe vs unsafe defaults for block containers #8992

Closed
fantasai opened this issue Jun 20, 2023 · 4 comments
Closed

[css-align-3] safe vs unsafe defaults for block containers #8992

fantasai opened this issue Jun 20, 2023 · 4 comments

Comments

@fantasai
Copy link
Collaborator

I'd like to propose making the default behavior of align-content be safe rather than unsafe for block containers that are not scroll containers.

I think this is a better default for block containers, and is likely also safer for Web-compat if we want to actually deploy this.

@astearns astearns added this to Tuesday in Cupertino F2F Agenda Jul 16, 2023
@dholbert
Copy link
Member

I'd like to propose making the default behavior of align-content be safe rather than unsafe for block containers that are not scroll containers.

Why the "that are not scroll containers" limitation? (I'm not necessarily objecting to it; I just want to understand the reasoning.)

At first glance, it seems like scroll containers may be a bit more risky since they impose a local clip on any unsafely-overflowing content that overflow off their start edge. (At least, that's how align-content:center; justify-content:center behave with overflow:scroll flex containers right now, in https://jsfiddle.net/58eg3a4w/ )

@dholbert
Copy link
Member

(posting the answer to my question after chatting with @fantasai in person): Per spec, scroll containers aren't supposed to clip stuff that gets pushed off the start edges via *-content. They're just supposed to establish a different initial scroll position.

That's not implemented anywhere yet, but it's what the spec says is supposed to happen, and it's why this in theory isn't an issue for blocks-that-are-scroll-containers.

@astearns astearns moved this from Tuesday to Unslotted in Cupertino F2F Agenda Jul 19, 2023
@atanassov atanassov moved this from Unslotted to Wednesday in Cupertino F2F Agenda Jul 19, 2023
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-align-3] safe vs unsafe defaults for block containers, and agreed to the following:

  • RESOLVED: default behavior for align-content on block containers is safe
The full IRC log of that discussion <emilio> fantasai: currently when you apply align-/justify-content to flex/grid they are unsafe, but ua's are not supposed to shift stuff off the unscrollable region, but nobody implements that
<emilio> ... for safe centering if the content is more than the container you clip to the top
<emilio> ... the spec behavior is technically limit by the scroll-container edges but nobody implements that
<emilio> ... the align is spec'd to also apply to block containers
<emilio> ... currently nobody implements that except the Firefox checkout on my laptop
<emilio> ... there are some concerns about web compat but also whether unsafe centering is right for block
<bramus> q+
<emilio> ... I think for block layout in general safe centering by default makes more sense
<emilio> ... also reduces the chances of a compat issue
<emilio> ... proposal is that for block containers we default to safe alignment
<emilio> Rossen_: this would be in both directions right?
<emilio> fantasai: block containers don't support justify-content, just align-content
<iank_> q+
<Rossen_> ack bramus
<emilio> bramus: the default grid/flex has definitely tripped off authors
<emilio> ... so +1 but people might rely on unsafe alignment?
<emilio> fantasai: not implemented anywhere yet
<Rossen_> ack iank_
<emilio> iank_: this seems fine overall
<oriol> q+
<emilio> ... we find that for table cells where they fall back to vertical-alignment: middle it uses unsafe
<emilio> ... as long as it's not messing with table cells seems fine
<emilio> ... I don't think it's a huge compat mitigation, the biggest risk is the new bfc behavior
<emilio> oriol: I'm reading that you're proposing it for block containers that are not scroll-container
<emilio> ... do you want to keep this distinction? If so, why?
<emilio> fantasai: for block containers that are scroll containers you don't have this unsafeness because you don't have overflow
<emilio> ... your entire scrollable region is aligned and the initial scroll position changes
<emilio> ... per spec, you're not supposed to shift the content
<emilio> ... you're supposed to change the initial scroll position
<emilio> oriol: I also wanted to ask that you mentioned that the default is unsafe, but wasn't there some magic if neither was specified?
<emilio> fantasai: yeah, which nobody implements. we wouldn't do that for blocks and just default to safe which is also simplere
<emilio> s/simplere/simpler
<emilio> RESOLVED: default behavior for align-content on block containers is safe

@yisibl
Copy link
Contributor

yisibl commented Apr 2, 2024

Is there a WPT test here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

4 participants