Repository navigation
docs(guide): add CSS Shadow Parts guide - #1530
Conversation
|
|
||
| For example, `my-component::part(button)::part(label)` does not match anything. This is because doing so would expose more structural information than is intended. | ||
|
|
||
| If the `<my-component>`’s internal button uses something like `part="label => button-label"` to forward the button’s internal parts up into the panel’s own part element map, then a selector like `my-component::part(button-label)` would select just the one button’s label, ignoring any other labels. No newline at end of file |
There was a problem hiding this comment.
I haven't seen this syntax before label => button-label. Is there an MDN doc we can link to where people can read more?
There was a problem hiding this comment.
I got it from Example 4 here: https://www.w3.org/TR/css-shadow-parts-1/#part
There was a problem hiding this comment.
Ok that should be fine. I guess it just doesn't make a lot of sense to me - the spec doesn't give much information as to the => syntax. (also the example they use doesn't make sense. why not just apply part="confirm-label" directly to the label?)
There was a problem hiding this comment.
I agree it's confusing. It's like the following:
<my-component>
#shadow-root
<my-button part="button">
#shadow-root
<div part="label"></div>
</my-button>
</my-component>So this wouldn't work:
my-component::part(button)::part(label) {but if the button somehow forwards the part then it would work like:
my-component::part(button-label)I guess it would look like this:
<my-component>
#shadow-root
<my-button part="button label => button-label">
#shadow-root
<div part="label"></div>
</my-button>
</my-component>I need to test this out though and then maybe I could add more usage. I don't think it applies to Ionic components right now.
There was a problem hiding this comment.
Ohh I see ok that makes sense. Yeah I don't think we use this in the framework anywhere?
There was a problem hiding this comment.
Not right now. This could maybe end up being a problem for things like ion-infinite-scroll-content, for example, if we allowed them to target parts on the spinner.
Co-authored-by: Liam DeBeasi <[email protected]>
Co-authored-by: Liam DeBeasi <[email protected]>
mhartington
left a comment
There was a problem hiding this comment.
Looks great! Left one small suggestion, but this could be merged in as it if it doesn't make sense.
| See <a href="https://github.com/w3c/csswg-drafts/issues/4530" target="_blank" rel="noopener noreferrer">this issue on GitHub</a> for more information. | ||
|
|
||
|
|
||
| ### Structural Pseudo-Classes |
There was a problem hiding this comment.
Could we have an example just to show what would work?
There was a problem hiding this comment.
For structural pseudo classes?
Implements a guide for CSS Shadow Parts. Adapted from https://ionicframework.com/blog/customize-your-ionic-framework-app-with-css-shadow-parts/
Closes #1343