-
Notifications
You must be signed in to change notification settings - Fork 376
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
Shadow dom: use css containment features by default #355
Comments
AFAIK, we haven't considered it yet. I've never seen a discussion. Thank you for filing an issue! Let's discuss how Shadow DOM could benefit from the CSS containment spec here. |
contain:style paint; might make sense for shadows as a default, but I think contain:layout is probably too restrictive as it requires you to have a definite height/width, i.e. you can't size to your children. contain:paint is pretty restrictive, but it might be OK. It would mean that a position:absolute or position:fixed inside that container would be clipped by the container. I'm not sure how much extra optimization we could do there without contain:layout though. We could in theory split contain:layout into two pieces. One that requires definite dimensions and another that gets the other properties (e.g. formatting context). That could be a compelling default. Then, any shadow that the author put a definite width/height on could magically get all the contain:strict benefits without the author needing to know to opt-in to contain:strict. |
Can you clarify what the second piece would be? If it's just formatting context, that's fairly easy - implement the Display spec, then default custom elements to In other words, having the UA stylesheet apply a |
Given #426 it seems this is fairly objectionable to some. We should instead provide hooks (pseudo-classes) to make this easy, but not have defaults. Anyone object to duping this? |
FWIW, the sizing part of contain: layout should be[1] getting split out into another keyword. This would make contain: layout a pretty safe default. |
Yeah, I'm much more in favor of |
How can these CSS properties be set by default but not in v1? There is no way we can change the default stylesheet on ShadowRoot once it ships. |
Ah, yeah, that v2 label was definitely wrong. This is a thing that needs a decision in v1, one way or another. |
Could someone summarize why we can restrict shadow trees by default by these css containment features? It's still unclear to me. It sounds like authors' has to "opt-opt" (by overriding UA stylesheet) if authors are not satisfied these restrictions. Because it is expected that authors are unlikely to use these features, we are using "opt-out" model, instead of "opt-in", right? |
If we are to have UA style, we need to resolve #426 because we do not have any way to style a shadow host. |
It sounds like the concrete proposal here is something like adding the following to the UA style sheet
Is that right? Earlier @tabatkins mentioned |
|
Good point, thanks for correcting me! |
Telecom Agreement: nobody seems to be strongly interested in this feature anymore so WONTFIX. |
Shadow Roots would benefit from the UA performance features introduced in the CSS containment spec (https://drafts.csswg.org/css-containment/). Has there be consideration on how this could work well with shadow shadow?
The text was updated successfully, but these errors were encountered: