We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
hey,
so in this draft https://tabatkins.github.io/specs/css-shadow-parts/#selectordef-theme
::theme can be used to modify every part in the entire subtree.
::theme
However, as part names do not need to be unique (at least I'm under that impression) this could result in various unwanted side effects.
UseCase: I want to style every my-alert element. Unfortunately, the author picked a very common part name header.
my-alert
header
Example Code:
<my-app> #shadow-root <h3 part="header">My App Header</h3> <my-dialog> #shadow-root <p part="header">My Dialog Header</p> <my-alert> #shadow-root <span part="header">My Alert Header</span> </my-alert> <my-alert> #shadow-root <span part="header">My Alert Header</span> </my-alert> </my-dialog> </my-app>
So if I where to use
my-app::theme(header) { background: green; }
that would affect (way too many parts):
<h3 part="header">My App Header</h3>
<p part="header">My Dialog Header</p>
<span part="header">My Alert Header</span>
while I only would like to affect (every part="header" within my-alert elements):
Could we add some way to limit it to certain tag-names (e.g. webcomponents with shadow-root)? Something like this comes to mind
my-app::theme(my-alert.header) { background: green; }
where my-alert represents the (optional) tag name header represents the part name
The text was updated successfully, but these errors were encountered:
Even better solution would be to split part and theme attributes as described here #1972
part names can be pretty generic... whereas theme names should be unique.
That would change the above example to
<my-app> #shadow-root <h3 part="header" theme="my-app-header">My App Header</h3> <my-dialog> #shadow-root <p part="header" theme="my-dialog-header">My Dialog Header</p> <my-alert> #shadow-root <span part="header" theme="my-alert-header">My Alert Header</span> </my-alert> <my-alert> #shadow-root <span part="header" theme="my-alert-header">My Alert Header</span> </my-alert> </my-dialog> </my-app>
obviously
my-app::theme(my-alert-header) { background: green; }
would work as expected :)
The best practice could be:
Sorry, something went wrong.
#1972 was solved so that should be the approach to go
No branches or pull requests
hey,
so in this draft
https://tabatkins.github.io/specs/css-shadow-parts/#selectordef-theme
::theme
can be used to modify every part in the entire subtree.Description
However, as part names do not need to be unique (at least I'm under that impression) this could result in various unwanted side effects.
UseCase:
I want to style every
my-alert
element. Unfortunately, the author picked a very common part nameheader
.Example Code:
So if I where to use
that would affect (way too many parts):
<h3 part="header">My App Header</h3>
<p part="header">My Dialog Header</p>
<span part="header">My Alert Header</span>
<span part="header">My Alert Header</span>
while I only would like to affect (every part="header" within
my-alert
elements):<span part="header">My Alert Header</span>
<span part="header">My Alert Header</span>
Suggestion
Could we add some way to limit it to certain tag-names (e.g. webcomponents with shadow-root)?
Something like this comes to mind
where
my-alert
represents the (optional) tag nameheader
represents the part nameThe text was updated successfully, but these errors were encountered: