-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Allow custom CSS for theme.json elements #48439
Comments
@carolinan Curious what it looks like to add selectors (if that's possible) to |
Oh snap, never mind. I think I figured it out:
|
Ok, it works in the editor with Gutenberg active, but not with WordPress 6.2 Beta 3 alone. |
@tellthemachines It seems custom CSS is also not working for the |
From memory custom CSS for individual blocks hadn't been implemented yet when I added block style variations to global styles. I don't think there's any particular reason for variations to not have it. |
It's super confusing:
But as theme developer, you can't do same in It feels like a bug or so |
That CSS input field is for the heading block, not element :) |
Yet another confusing thing 😅 |
No progress has been made here and this issue was merely forwarded into the 6.5 board for consideration. Punting out of it as a result. |
It is quiet difficult to make progress when nobody is able to pick up items that has waited for review for 3 months. |
Agreed. There's a ton going on right now in the project and it's a great reminder that folks who can dedicate time to purely reviewing would go a long way, impact wise. |
Hi folks, |
@aaronrobertshaw @andrewserong @tellthemachines @t-hamano informed me in a different issue that custom CSS for elements in theme.json is working since 6.6. If I add this theme.json file:
The links have a green border, but the CSS is not in the additional CSS field in the Site Editor. While if I add this theme.json file. it does show in the additional CSS field:
For Twenty Twenty-Four and Twenty Twenty-Five there are open issues where it is brought up that the CSS for the link focus style can be removed by users in the additional CSS field, which may be undesirable. |
Good question. A possible third option is that it's a missing feature? Ideally it'd be exposed somewhere in the UI in order for folks to override it. I haven't looked at the code, but I imagine the absence from the site editor UI is that it hasn't been added anywhere for it to be editable 🤔. The current UI for elements doesn't appear to have a natural place for Additional CSS to be made available for them? Whereas for blocks you can drill down into a particular block and then go to the Advanced panel, elements are currently only accessible from a particular property, like Color, it seems... |
I think @andrewserong has hit the nail on the head here. Looking at the Global Styles sidebar you can see that elements are only accessible to style within the context of the typography or color drill downs at the root level. Within a block type, only the element's color can be styled. Adding a custom CSS field to the typography or color screens for elements doesn't make a lot of sense to me. With the expansion of block style variations to include element and inner block type styling, the overall information architecture for the Global Styles panel is ripe for review.
|
Lets close this and when it becomes relevant, open a new issue for displaying it in the UI. |
What problem does this address?
This is a minor inconvenience, but it means one will have to remember where
CSS
is allowed and not 😅Theme.json does not allow
CSS
inelements
, which means one can't do something likeInstead, one would need to add it to
CSS
directly understyles
and add the selector for the element.What is your proposed solution?
Allow custom CSS for theme.json elements.
The text was updated successfully, but these errors were encountered: