-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Accordion Heading: Add default style for classic themes #73608
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
Conversation
|
Size Change: +14 B (0%) Total Size: 2.57 MB
ℹ️ View Unchanged
|
cef0465 to
4b02049
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
aaronrobertshaw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this @t-hamano 👍
Block Themes:
✅ Custom styles in theme.json or Global Styles apply correctly to the Accordion
Classic Themes:
✅ The toggle button inherits text and background color.
✅ The toggle button has no text-decoration style.
✅ When the toggle button is focused by the tab key, the outline should be visible.
✅ When the toggle button is hovered, the text-decoration style should be applied.
The only issue I spotted was I think the test styles in the emptytheme theme.json were committed.
I'll approve this pending removal of those changes.
Nice work 🙇
Fixes #73454
What?
This PR moves some styles for the Accordion Heading block to the
classic.scssso that consumers can override the default styles via the global styles or theme.jsonWhy?
In #73032, we added some styles with high CSS specificity to enforce default styles for many themes, especially classic themes. This requires theme developers to use higher CSS specificity selectors or import statements to override default styles, making it less extensible.
How?
Move most of the styles we added for the classic theme into the
classic.scssfile. This stylesheet is only enqueued when the classic theme (or more precisely, a theme without a theme.json) is active. This makes it easier to override the default styles via the global styles or theme.json.Testing Instructions
Activate the Emptytheme and update the theme.json with the following definitions. This code is based on the Styling accordions in WordPress 6.9 documentation. All custom styles should now be applied correctly.
theme.json
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 3, "settings": { "appearanceTools": true, "layout": { "contentSize": "840px", "wideSize": "1100px" } }, "styles": { "blocks": { "core/accordion-item": { "border": { "color": "#d5dae2", "style": "solid", "width": "1px", "radius": "12px" }, "color": { "background": "#f6f7f9", "text": "#343b46" }, "shadow": "0 10px 15px -3px #80000080, 0 4px 6px -4px #80000080" }, "core/accordion-heading": { "css": "&__toggle { padding: var(--wp--preset--spacing--40) var(--wp--style--block-gap); }", "typography": { "fontFamily": "inherit", "fontSize": "inherit", "fontStyle": "inherit", "fontWeight": "500", "lineHeight": "inherit", "textTransform": "inherit" } }, "core/accordion-panel": { "spacing": { "padding": { "top": "var(--wp--style--block-gap)", "bottom": "var(--wp--style--block-gap)", "left": "var(--wp--style--block-gap)", "right": "var(--wp--style--block-gap)" } } } } } }Next, activate any of the default classic themes. Ensure the following styles are achieved: