[wp-trac] [WordPress Trac] #54671: Font weight doesn't always change

WordPress Trac noreply at wordpress.org
Mon Feb 7 23:36:49 UTC 2022

#54671: Font weight doesn't always change
 Reporter:  sc456a         |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  5.9.1
Component:  Editor         |     Version:  5.9
 Severity:  normal         |  Resolution:
 Keywords:  needs-testing  |     Focuses:  ui

Comment (by ironprogrammer):

 Thank you for this report, @sc456a! Your video was very detailed and
 helped a lot.

 What's happening is that the Bold setting via the inline modal toolbar has
 a higher precedence than the block's ''Typography > Appearance'' settings.
 This functions by design.

 == Explanation
 The Bold (**B**) button wraps the selected text with a `<strong>` tag,
 which WordPress's common CSS sets to `font-weight: 600`.

 The styling is subject to the highest level specificity, which in this
 case is the `<strong>` tag itself, which is the closest tag/selector to
 the text in question. This tag therefore overrides the parent heading's
 `font-weight` settings. The sidebar only sets the style at the wrapping
 heading tag, which is less specific:


 The same is true of the Italic (''**I**'') inline setting. Regardless of
 the ''Typography > Appearance'' font style, an `<em>` tag set on the text
 will override the styling applied to the entire block. The resulting
 behavior may seem weird here because italics is a single font variant,
 whereas font-weight has multiple variant weights.

Ticket URL: <https://core.trac.wordpress.org/ticket/54671#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list