Make WordPress Core

Opened 2 years ago

Last modified 3 weeks ago

#61885 new defect (bug)

Twenty Fifteen: Search Block button does not have theme's styling in the editor

Reported by: pitamdey Owned by:
Priority: normal Milestone: Future Release
Component: Bundled Theme Version:
Severity: normal Keywords: has-screenshots has-test-info dev-feedback
Cc: Focuses: css

Description

In Theme Twenty Fifteen, Search Block button text is lowercase in editor and uppercase in frontend

Attachments (7)

Screenshot 2024-08-16 at 10.19.27 AM.png​ (231.2 KB ) - added by pitamdey 2 years ago.
Editor View
Screenshot 2024-08-16 at 10.20.01 AM.png​ (352.2 KB ) - added by pitamdey 2 years ago.
Frontend View
61885.patch​ (378 bytes ) - added by pitamdey 2 years ago.
After applying this solution the issue is resolved
61885.2.patch​ (429 bytes ) - added by viralsampat 2 years ago.
I have checked above mentioned issue and I have resolved it and added patch.
61885.3.patch​ (691 bytes ) - added by shailu25 2 years ago.
Patch Updated.
61885.4.patch​ (658 bytes ) - added by shailu25 2 years ago.
Corrected Search CSS Placement in editor-blocks.css
61885.5.patch​ (859 bytes ) - added by pitamdey 2 years ago.
Updated Patch

Download all attachments as: .zip

Change History (16)

@pitamdey
2 years ago

After applying this solution the issue is resolved

#1 @narenin
2 years ago

  • Keywords has-testing-info added

Hi,

Test Report

Patch tested: https://core.trac.wordpress.org/attachment/ticket/61885/61885.patch

Environment:

OS: Windows
PHP: 8.2.12
WordPress: 6.6.1
Browser: Chrome
Theme: Twenty Fifteen (Version: 3.8)
Plugins: None activated
Actual Results:

✅ Before patch:
Backend: ​https://prnt.sc/hInRByb1ruU-
Frontend: ​https://prnt.sc/VFCDjlBcDP_t

✅ After patch:
Backend: ​https://prnt.sc/hInRByb1ruU-
Frontend: ​https://prnt.sc/E4kVg9ED-tdM

✅ Patch working well as desired solution.

@viralsampat
2 years ago

I have checked above mentioned issue and I have resolved it and added patch.

#2 @sabernhardt
2 years ago

  • Keywords needs-patch added
  • Milestone Awaiting Review → Future Release
  • Summary Twenty Fifteen : Search Block button text is lowercase in editor and uppercase in frontend → Twenty Fifteen: Search Block button does not have theme's styling in the editor

The Search button's colors and font are also wrong in the editor.

The editor-blocks stylesheet needs styles to match button styles on the front end.

/* Search */

.wp-block-search__button {
	background-color: #333;
	color: #fff;
	font-family: "Noto Sans", sans-serif;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
}

@shailu25
2 years ago

Patch Updated.

#3 @shailu25
2 years ago

  • Keywords needs-patch removed

@shailu25
2 years ago

Corrected Search CSS Placement in editor-blocks.css

#4 @sabernhardt
2 years ago

These styles could fit better in the Widgets section (between Latest Posts and Colors).

Considering other elements of the Search block:

  • The label matches the front.
  • The input has a significantly different font-family. The editor appearance might benefit from (some of) these rules:
    .wp-block-search .wp-block-search__input {
      border-radius: 0;
      color: rgba(51, 51, 51, 0.7);
      font-family: "Noto Sans", sans-serif;
      font-size: 1em;
      padding: 0.5em;
    }
    

@pitamdey
2 years ago

Updated Patch

#5 @wordpressdotorg
19 months ago

  • Keywords has-test-info added; has-testing-info removed

#6 @karmatosed
2 months ago

  • Keywords needs-testing added

Looks like this needs testing now, so let's get that happening, thank you everyone.

#7 follow-up: @jahirulwp
2 months ago

Test Report

Patch tested: 61885.5.patch

Environment

  • WordPress: 7.1.1
  • Theme: Twenty Fifteen 4.3
  • PHP: 8.3.33
  • Browser: Chrome (desktop)
  • Plugins: none active
  • Environment: WordPress Playground (in-browser)

Note on method: Playground has no patch tool, so the diff's CSS was pasted into css/editor-blocks.css at the exact location the diff specifies (after the .wp-block-latest-posts.is-grid li rule, before section 7.0).

Summary: the button half of this patch has no effect, and the symptom in the original report no longer reproduces on 7.1.1.

1. The front end is no longer uppercase

Computed styles for .wp-block-search__button on the front end:

font-family:      "Noto Serif", serif
font-size:        19px
font-weight:      400
text-transform:   none
color:            rgb(255, 255, 255)
background-color: rgb(50, 55, 60)

Twenty Fifteen's css/blocks.css contains no .wp-block-search rules at all, so the front-end button is not styled by the theme. It inherits the theme's typography and picks up core's Global Styles button defaults.

2. After applying 61885.5.patch

  • The .wp-block-search .wp-block-search__input rules apply correctly.
  • The .wp-block-search__button rules do not apply — computed values unchanged.

Cause: core prints an inline Global Styles rule into the editor:

:root :where(.wp-element-button, .wp-block-button__link) {
	background-color: rgb(50, 55, 60);
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
}

:where() contributes no specificity, so that selector scores (0,1,0) — identical to .wp-block-search__button — and it is output after the theme's editor-blocks.css, so it wins on source order.

Raising the selector to .wp-block-search .wp-block-search__button (0,2,0) makes the rule apply. Verified:

font-family: "Noto Sans", sans-serif
font-size: 14px
font-weight: 700
text-transform: uppercase
background-color: rgb(51, 51, 51)

3. Note on direction

Even with the specificity fixed, the values in this patch (Noto Sans / 14px / 700 / uppercase / #333) do not match what the Search block renders on the front end in 7.1.1 (Noto Serif / 19px / 400 / none / #32373c). Applying it as-is would replace the current mismatch with a different one.

The editor/front-end differences that remain in 7.1.1 are:

  • input font-size: 14px editor vs 19px front end
  • input color: rgb(30, 30, 30) vs rgba(51, 51, 51, 0.7)
  • input border-radius: 2px vs 0
  • input padding: 0 12px vs ~10px
  • button font-size: 17px vs 19px

It may be worth confirming the intended target before the patch is refreshed: match the block's current front-end rendering, or give the block Twenty Fifteen's classic button styling in both blocks.css and editor-blocks.css.

#8 @r1k0
3 weeks ago

  • Keywords dev-feedback added; needs-testing removed

Reproduction Report

Environment

  • WordPress: 7.1.3
  • Subdirectory: No
  • PHP: 8.3.33
  • Server: PHP.wasm
  • Database: WP_MySQL_On_SQLite (Server: 8.0.38-mysql-on-sqlite-3.1.0 / Client: 3.51.0)
  • Browser: Chrome 155.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Fifteen 4.3
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.3.1

Steps taken

  1. In a post/page, add a search block and publish it.
  2. Observe the styling of the search button in the editor and the frontend.
  3. ❌ Bug is not occurring

Expected behavior

  • The button should have the same styling on both the editor and frontend.

Additional Notes

  • The issue seems to have been fixed (not as the PR author intended, but fixed).
  • I believe this is due to the theme being able to load the core global styles from themes.json.
  • Updating keywords by removing needs-testing because the issue is no longer present.
  • Updating keywords by adding dev-feedback to get feedback on whether proceeding with the PR is feasible.

Screenshots/Screencast with results

  • Frontend

https://i.ibb.co/n8kSHhXZ/Screenshot-2026-10-26-032122.png

  • Editor

https://i.ibb.co/GvXtRMbv/Screenshot-2026-10-26-032311.png

#9 in reply to: ↑ 7 @sabernhardt
3 weeks ago

core prints an inline Global Styles rule into the editor:

:root :where(.wp-element-button, .wp-block-button__link) {
	background-color: rgb(50, 55, 60);
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
}

:where() contributes no specificity, so that selector scores (0,1,0) — identical to .wp-block-search__button — and it is output after the theme's editor-blocks.css, so it wins on source order.

WordPress 7.0 introduced that bug, which affects more themes than Twenty Fifteen. If that remains in the global styles at the 0-1-0 specificity, the theme would need to set every rule in both the front end and editor stylesheets at a higher specificity to restore the original button style.

The discrepancies between the editor and front end right now are minor.

Note: See TracTickets for help on using tickets.