- Notifications
You must be signed in to change notification settings - Fork 3.2k
Fix: Calendar header styles inconsistency in Twenty Twenty theme #8110
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
base: trunk
Are you sure you want to change the base?
Fix: Calendar header styles inconsistency in Twenty Twenty theme #8110
Conversation
| 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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
sabernhardt 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.
I suggested some changes to simplify the style rules and to fix the spacing (tabs and empty lines).
I'm still unsure whether inheriting the custom font-weight is best, but that discussion belongs on the ticket.
| .editor-styles-wrapper .wp-calendar-table caption { | ||
| padding: 0.5em; | ||
| font-weight: 600; | ||
| } | ||
| :root .editor-styles-wrapper :where(.wp-block-calendar[style*="font-weight"]) caption, | ||
| :root .editor-styles-wrapper :where(.wp-block-calendar *[style*="font-weight"]) ~ caption { | ||
| font-weight: inherit; | ||
| } |
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.
| .editor-styles-wrapper .wp-calendar-table caption { | |
| padding: 0.5em; | |
| font-weight: 600; | |
| } | |
| :root .editor-styles-wrapper :where(.wp-block-calendar[style*="font-weight"]) caption, | |
| :root .editor-styles-wrapper :where(.wp-block-calendar *[style*="font-weight"]) ~ caption { | |
| font-weight: inherit; | |
| } | |
| .editor-styles-wrapper caption { | |
| padding: 0.5em; | |
| font-weight: 600; | |
| } | |
| .editor-styles-wrapper :where(.wp-block-calendar[style*="font-weight"]) caption { | |
| font-weight: inherit; | |
| } |
The front-end styles add the padding and font weight to any caption element, so I would not restrict it to one block in the editor. However, adjusting for a custom font weight can be focused on the Calendar block (the standard Table block does not use the caption element).
| :root :where(.wp-block-calendar[style*="font-weight"]) caption, | ||
| :root :where(.wp-block-calendar *[style*="font-weight"]) ~ caption { | ||
| font-weight: inherit; | ||
| } | ||
| | ||
| .wp-calendar-nav .wp-calendar-nav-prev { | ||
| font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif; | ||
| } |
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.
| :root :where(.wp-block-calendar[style*="font-weight"]) caption, | |
| :root :where(.wp-block-calendar *[style*="font-weight"]) ~ caption { | |
| font-weight: inherit; | |
| } | |
| .wp-calendar-nav .wp-calendar-nav-prev { | |
| font-family: "Inter var", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif; | |
| } | |
| :where(.wp-block-calendar[style*="font-weight"]) caption { | |
| font-weight: inherit; | |
| } | |
This section can be simpler:
- The
captiononly needs the specificity of one element to override the theme's default600font weight. - The
:where(.wp-block-calendar *[style*="font-weight"]) ~ captionselector would not match any elements because the Calendarcaptiondoes not have siblings before it. - Instead of rewriting the "Inter var" font list in this section, you could add
.entry-content .wp-block-calendar(between archives and categories) in two lists of block selectors plus the PHP array. Then the font would apply to both the previous and next months' links.
Trac ticket
Trac ticket: https://core.trac.wordpress.org/ticket/62781
I have addressed the issue and created a new PR to ensure the following: