-
Notifications
You must be signed in to change notification settings - Fork 378
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
Should shadow host have display: block
by default?
#426
Comments
This would still result in a flush of contents when custom elements are upgraded but its behavior is a lot more easier to understand as simply having UA stylesheet with: :host { display: block; } and it's probably less confusing for authors. |
A couple of thoughts:
How about having another pseudo class, like If we prefer primitives, we might want to separate it into e.g. :custom:shadowhost {
display: block;
} |
For the sake of consistency, I would suggest using dash-case naming convention, like |
Yeah, |
I don't really understand the difference between :shadowhost and :host? From a developer perspective, at least? That is, when would a developer ever use :shadowhost instead of :host? |
Would :custom apply to only custom elements, or would it also apply to undefined potentially-custom elements (i.e. any element whose name is a valid custom element name)? |
e.g.
I thought that |
@domenic Thus if a document has several shadow dom components, one |
I see. I wish we could use In general I think these are good ideas and it would be best to just come up with names. I suggest |
How about (We could shorten them and remove "shadow" but remember that |
I don't think that distinction is clear. If anything, I'd call the former |
Thus, |
These new pseudo classes splayed out across multiple comments are very confusing.
Does that sound right? If so, I don't think there's a real usecase for Would |
Sorry, I noticed I never replied to this:
Yes, it would, but you could do |
It looks like this issue morphed into something entirely different about defining a new pseudo element. I think we should file a separate issue to track this rather than re-using this issue. |
Okay. Let me close this issue without any action because:
|
@hayatoito @domenic I like the idea of What I'm imagining is that the following
results in a render tree that is more along the lines of
But, it seems like that's not the case based on this discussion. Why not? EDIT: nevermind, after thinking about it, it makes sense that the host (while being |
Another question here is whether the shadow root should be a CSS stacking context. I don't think it should be possible to inter-layer shadow content and page content with z-index. |
Or should the result be only dependent on the final composed tree? That
seems to meet expectations.
…On May 18, 2017 1:55 PM, "Simon Fraser" ***@***.***> wrote:
Another question here is whether the shadow root should be a CSS stacking
context. I don't think it should be possible to inter-layer shadow content
and page content with z-index.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#426 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASKzkkXDcmml64Iwa3Mrc_HqEdoSl8dks5r7LAqgaJpZM4HsKQ4>
.
|
Making shadow roots ignore CSS and have new stacking contexts is going to
destroy custom elements used for CSS 3D scenes.
…On May 18, 2017 1:55 PM, "Simon Fraser" ***@***.***> wrote:
Another question here is whether the shadow root should be a CSS stacking
context. I don't think it should be possible to inter-layer shadow content
and page content with z-index.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#426 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASKzkkXDcmml64Iwa3Mrc_HqEdoSl8dks5r7LAqgaJpZM4HsKQ4>
.
|
Or at least it will prevent shadow dim from being usable with 3D scenes
(f.e. with preserve-3d). That would be extremely bad.
…On May 18, 2017 2:53 PM, "/#!/JoePea" ***@***.***> wrote:
Making shadow roots ignore CSS and have new stacking contexts is going to
destroy custom elements used for CSS 3D scenes.
On May 18, 2017 1:55 PM, "Simon Fraser" ***@***.***> wrote:
> Another question here is whether the shadow root should be a CSS stacking
> context. I don't think it should be possible to inter-layer shadow content
> and page content with z-index.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#426 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AASKzkkXDcmml64Iwa3Mrc_HqEdoSl8dks5r7LAqgaJpZM4HsKQ4>
> .
>
|
One thing I don't think was covered much, is for example: if all custom elements have Seems like defaults should be inherited from parent classes. For example, I think it'd make sense that if we inherit from So, instead of defining a single default for all custom elements in the spec, why not define a way in which certain features (like Maybe the class MyElement extend HTMLElement {
static display = 'inline'
} This particular style may appear as a "user agent stylesheet" (as seen in Chrome devtools for example). Inheritance like this (with |
In contrast to solutions like Also imagine elements that do not need shadow roots, but still want custom styling. #468 may solve it, but:
Class inheritance seems to be the best way to do it, considering that we're using Library author makes a class: export default
class SomeEl extends HTMLElement {
suppose custom elements can provide "user agent" styles, like builtins.
static stylesheet = `
display: block
`
// or, now that we're gonna have constructible stylesheets:
static stylesheet = new CSSStyleSheet( ... )
} Then the end user can use the element: import SomeEl from 'some-lib'
// avoids a name clash with another custom element lib
customElements.define('somelib-el', SomeEl) // has default style End user can also extend from it, inheriting the default style: class NewEl extends SomeEl {
connectedCallback() { ... }
// etc...
}
customElements.define('new-el', NewEl) // has the same default style |
I went down this thought path, because I thought we're using classes, so why not then take advantage of inheritance? |
My problem with GrapesJS was that my custom webcomponent was by default displaying vertical rather than horizontal placeholders when dragging and dropping components on the editor canvas. Default ( With I was not aware that currently the default is With custom webcomponents to address the top-level node one uses the Anyways, your suggestion saved my day. Thank you! |
Continuing my proposal / question in #224 (comment) here:
Do most of custom elements that have
display: block
rule attach a shadow DOM? If so, should we make every shadow host default to use usedisplay: block
?Making custom elements default to
display: block
is problematic because we have to do either:display
value changes when an unresolved custom element becomes upgradeddisplay
value for all existing unknown elements with-
in its nameThe text was updated successfully, but these errors were encountered: