Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#56737 closed defect (bug) (fixed)

theme.json link styles overrides link styles in the front view of the WordPress adminbar

Reported by: poena's profile poena Owned by: audrasjb's profile audrasjb
Milestone: 6.1 Priority: normal
Severity: normal Version: 6.1
Component: Toolbar Keywords: has-patch commit
Focuses: Cc:

Description (last modified by poena)

If a theme includes a theme.json file and sets a font-style on links, the font-style also changes the links in the WordPress admin bar, when the admin bar is visible on the front of the website.

Originally reported by @audrasjb in the GitHub repository for Twenty Twenty-Three

Steps to reproduce

On your WordPress install, please make sure that the WordPress adminbar is set to display on the front of the website (User > toolbar, Show Toolbar when viewing site).

  1. Activate Twenty Twenty-Three
  2. Go to Appearance, Editor (beta)
  3. Open the Styles sidebar. Select the style variation called "Block Out".
  4. Save and view the front.
  5. Confirm if the admin bar has italic link texts. (This is the bug)

Alternatively, add the following to theme.json in your chosen test theme and view the front of the website:

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"styles": {
		"elements": {
			"link": {
				"typography": {
					"fontStyle": "italic"
				}
			}
		}
	}
}

Attachments (3)

56737.diff (502 bytes) - added by poena 3 years ago.
Add font-style: normal to the admin bar
Capture d’écran 2022-10-05 à 15.20.50.png (181.7 KB) - added by audrasjb 3 years ago.
Before patch
Capture d’écran 2022-10-05 à 15.22.13.png (177.1 KB) - added by audrasjb 3 years ago.
After patch: all good!

Download all attachments as: .zip

Change History (9)

#1 @poena
3 years ago

  • Description modified (diff)

@poena
3 years ago

Add font-style: normal to the admin bar

#2 @poena
3 years ago

  • Keywords has-patch added

The patch adds font-style:normal to the WordPress admin bar, so that the font-style is no longer inherited from the theme.json styles.

To test, apply the patch -build the minified & rtl styles, and follow the "Steps to reproduce", but confirm that the link text in the admin bar is not italic.

Last edited 3 years ago by poena (previous) (diff)

#3 @audrasjb
3 years ago

  • Milestone changed from Awaiting Review to 6.1
  • Owner set to audrasjb
  • Status changed from new to accepted
  • Version set to trunk

Thanks @poena! Looks good to me 👍

@audrasjb
3 years ago

After patch: all good!

#4 @audrasjb
3 years ago

  • Keywords commit added

#5 @audrasjb
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 54395:

General: Add a default font-style value for Adminbar links.

If a theme includes a theme.json file and sets a specific font-style on links, the font-style also changes the links in the WordPress admin bar, when the admin bar is visible on front-end. For example, this happens with the pitch style variation of Twenty Twenty-Three.

Using a default value for the font-style property prevents theme.json files from overriding it.

Props audrasjb, poena.
Fixes #56737.

#6 @sabernhardt
3 years ago

  • Component changed from General to Toolbar
Note: See TracTickets for help on using tickets.