Skip to content

Conversation

@NidhiDhandhukiya74
Copy link

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:

  1. The default font weight for the caption is set to 600 in both the editor and front end.
  2. The Typography > Appearance option now correctly adjusts the font weight of the caption in both the editor and front.
@github-actions
Copy link

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props nidhidhandhukiya. 

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Copy link

@sabernhardt sabernhardt left a 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.

Comment on lines +506 to +513
.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;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.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).

Comment on lines +3078 to +3085
: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;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
: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:

  1. The caption only needs the specificity of one element to override the theme's default 600 font weight.
  2. The :where(.wp-block-calendar *[style*="font-weight"]) ~ caption selector would not match any elements because the Calendar caption does not have siblings before it.
  3. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants