Skip to content

Site Title: Drop the Fit text !important rule from editor.scss - #85166

Merged
aaronrobertshaw merged 1 commit into
trunkfrom
fix/site-title-fit-text-white-space
Oct 21, 2026
Merged

aaronrobertshaw merged 1 commit into
trunkfrom
fix/site-title-fit-text-white-space

Conversation

@aaronrobertshaw

Copy link
Copy Markdown
Contributor

Related:

What?

Removes the !important Fit text rule from the Site Title editor styles. The editable title now sets its own white-space inline.

Why?

Rich text puts an inline white-space: pre-wrap on the editable element. With Fit text on, that kept the title wrapping, so editor.scss overrode it with white-space: inherit !important.

Rich text keeps an inline white-space that is already set, so the block can pass the right value directly. That removes the need for !important.

How?

  • Passes style={ { whiteSpace: fitText ? 'inherit' : 'pre-wrap' } } on the editable RichText.
  • Both values are explicit. Rich text only sets its default on mount, so toggling Fit text off would otherwise leave normal.
  • Deletes the !important rule. The placeholder rule and editorStyle stay.

The read-only title (users who cannot edit site settings) has no rich text, so it needs no change.

Testing Instructions

  1. Add a Site Title block with a long site title.
  2. Turn Fit text on. The title stays on one line and scales to fit, in the editor and on the front end.
  3. Turn Fit text off without reloading. The title wraps again.
  4. Type spaces into the title with Fit text on and off. Confirm they behave as on trunk.

Checked at 1440px and 390px. Every computed value matches trunk:

Editable Inline white-space Computed white-space
Trunk, Fit text on pre-wrap (beaten by !important) nowrap
This PR, Fit text on inherit nowrap
Trunk and this PR, Fit text off pre-wrap pre-wrap

Use of AI Tools

Implemented and verified by a Claude Code agent from a predefined task.

@aaronrobertshaw aaronrobertshaw added [Type] Code Quality Issues or PRs that relate to code quality [Block] Site Title Affects the Site Title Block labels Oct 20, 2026
@aaronrobertshaw aaronrobertshaw self-assigned this Oct 20, 2026
@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>

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

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: -225 B (0%)

Total Size: 8.97 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 442 kB +24 B (+0.01%)
build/styles/block-library/editor-rtl.css 13 kB -20 B (-0.15%)
build/styles/block-library/editor-rtl.min.css 10.6 kB -24 B (-0.23%)
build/styles/block-library/editor.css 13 kB -21 B (-0.16%)
build/styles/block-library/editor.min.css 10.6 kB -24 B (-0.23%)
build/styles/block-library/site-title/editor-rtl.css 93 B -43 B (-31.62%) 🎉
build/styles/block-library/site-title/editor-rtl.min.css 85 B -37 B (-30.33%) 🎉
build/styles/block-library/site-title/editor.css 93 B -43 B (-31.62%) 🎉
build/styles/block-library/site-title/editor.min.css 85 B -37 B (-30.33%) 🎉

a36c42e Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric a2d0937 trunk % Change
timeToFirstByte 46.85 ms +11.85% -4.59% 46.65 ms +7.18% -2.89% 0.43%
largestContentfulPaint 86 ms +2.33% -6.98% 80 ms +10% -5% 7.5%
lcpMinusTtfb 37.2 ms +10.08% -12.77% 32.75 ms +22.6% -7.02% 13.59%
wpBeforeTemplate 23.87 ms +10.43% -3.64% 23.52 ms +9.06% -1.45% 1.49%
wpTemplate 19.32 ms +1.97% -7.3% 18.97 ms +5.69% -3.69% 1.85%
wpTotal 43.23 ms +11.13% -4.97% 42.82 ms +7.57% -2.59% 0.96%
wpMemoryUsage 7.64 MB +0% -0% 7.61 MB +0% -0% 0.46%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric a2d0937 trunk % Change
timeToFirstByte 38.35 ms +5.08% -1.17% 34.2 ms +4.82% -1.32% 12.13%
largestContentfulPaint 88 ms +4.55% -0% 76 ms +5.26% -0% 15.79%
lcpMinusTtfb 50.1 ms +1.4% -1.5% 42.8 ms +6.43% -1.75% 17.06%
wpBeforeTemplate 20.75 ms +2.02% -3.28% 20.67 ms +6.29% -1.98% 0.39%
wpTemplate 14.42 ms +5.41% -2.36% 10.72 ms +3.82% -1.12% 34.51%
wpTotal 35.35 ms +5.09% -1.67% 31.38 ms +5.35% -1.78% 12.65%
wpMemoryUsage 6.33 MB +0% -0% 6.19 MB +0% -0% 2.39%
wpDbQueries 13 +0% -0% 9 +0% -0% 44.44%

media-processing

Metric a2d0937 trunk % Change
mediaProcessingJpeg 385.85 ms +1.42% -0.43% 385.01 ms +0.17% -1.08% 0.22%
mediaProcessingAvif 5605.25 ms +0.24% -0.13% 5610.51 ms +0.36% -0.15% -0.09%
mediaProcessingJpegToAvif 3832.23 ms +0.19% -0.15% 3831.74 ms +0.32% -0.23% 0.01%

media-upload

Metric a2d0937 trunk % Change
jpegUploadProcessing 1423.41 ms +2.31% -1.06% 1424.7 ms +0.7% -0.32% -0.09%
pngUploadProcessing 200.25 ms +4.11% -1.77% 202.16 ms +6.18% -2.34% -0.94%
largeJpegUploadProcessing 1399.27 ms +0.98% -0.24% 1414.92 ms +0.78% -1.18% -1.11%
multipleImageUploadProcessing 1525.15 ms +1.04% -0.82% 1534.71 ms +0.95% -1.71% -0.62%

post-editor

Metric a2d0937 trunk % Change
serverResponse 502.84 ms +7.71% -3.65% 509.24 ms +4.72% -4.79% -1.26%
firstPaint 283.07 ms +85.83% -18.72% 319.2 ms +71.38% -25.24% -11.32%
domContentLoaded 1285.08 ms +0.48% -3.92% 1265.31 ms +1.36% -2.69% 1.56%
loaded 1286.38 ms +0.47% -3.91% 1266.51 ms +1.38% -2.68% 1.57%
firstContentfulPaint 546.23 ms +3.98% -9.59% 524.96 ms +4.92% -11.78% 4.05%
firstBlock 3933.43 ms +1.71% -3.31% 3969.1 ms +1.7% -2.82% -0.9%
type 19.26 ms +11.99% -2.7% 19.42 ms +6.64% -4.17% -0.82%
typeWithoutInspector 20.23 ms +2.67% -0.54% 20.73 ms +8.54% -9.21% -2.41%
typeWithTopToolbar 25.67 ms +5.22% -4.25% 28.4 ms +6.55% -12.36% -9.61%
typeContainer 8.99 ms +9.45% -10.34% 9.55 ms +10.47% -6.28% -5.86%
focus 127.61 ms +10.38% -5.84% 123.09 ms +5.75% -8.04% 3.67%
firstFocus 243 ms +0% -0% 236.48 ms +0% -0% 2.76%
selectAll 594.72 ms +0.5% -1.09% 577.29 ms +2.42% -1.74% 3.02%
listViewOpen 85.46 ms +5.32% -5.53% 78.43 ms +8.9% -4.08% 8.96%
inserterOpen 44.74 ms +5.3% -8.25% 40.75 ms +18.16% -3.31% 9.79%
inserterHover 12.71 ms +12.2% -10.62% 13.16 ms +7.9% -15.81% -3.42%
inserterSearch 8.15 ms +6.87% -9.33% 8.18 ms +10.51% -2.32% -0.37%
loadPatterns 674.32 ms +2.97% -2.81% 692.71 ms +3.4% -2.6% -2.65%
wpTotal 492.39 ms +8.02% -3.51% 499.65 ms +4.88% -4.9% -1.45%
wpMemoryUsage 14.66 MB +0% -0% 14.63 MB +0% -0% 0.26%
wpDbQueries 54.5 +0.92% -0.92% 54.5 +0.92% -0.92% 0%

site-editor

Metric a2d0937 trunk % Change
serverResponse 245.27 ms +4.6% -1.17% 248.18 ms +3.36% -8.09% -1.17%
firstPaint 225.01 ms +47.21% -32.12% 197.76 ms +28.23% -15.45% 13.78%
domContentLoaded 754.43 ms +2.92% -3.07% 758.73 ms +2.15% -4.96% -0.57%
loaded 755.31 ms +2.94% -3.1% 759.59 ms +2.13% -4.95% -0.56%
firstContentfulPaint 331.95 ms +3.54% -2.47% 332.3 ms +4.37% -7.48% -0.11%
firstBlock 2843.71 ms +2.68% -1.16% 2856.7 ms +0.76% -0.66% -0.45%
type 16.58 ms +17.97% -1.75% 14.61 ms +2.26% -7.46% 13.48%
navigate 87.74 ms +18.87% -3.03% 80.8 ms +8.81% -4.23% 8.59%
loadPatterns 959.15 ms +16.08% -11.56% 908.53 ms +33.39% -4.19% 5.57%
loadPages 1034.46 ms +4.55% -3.95% 975.69 ms +3.3% -3.53% 6.02%
wpTotal 239.29 ms +4.63% -1.28% 242.06 ms +3.42% -8.37% -1.14%
wpMemoryUsage 12.70 MB +0% -0% 12.66 MB +0% -0% 0.29%
wpDbQueries 44.5 +1.12% -1.12% 44.5 +1.12% -1.12% 0%

a36c42e Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Regression: updating a specific option will only change its value and will not corrupt others in /test/e2e/specs/editor/various/core-settings.spec.js, passed after 1 failed attempt.
Error: expect(received).toStrictEqual(expected) // deep equality

- Expected  - 1
+ Received  + 1

  Array [
    "rewrite_rules",
-   "SERIALIZED DATA",
+   "",
  ]
    at forEach (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:46:26)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/core-settings.spec.js:43:35
persists Copy and Images guidelines across a refresh in /test/e2e/specs/admin/guidelines.spec.js, passed after 1 failed attempt.
Error: expect(locator).toHaveValue(expected) failed

Locator:  getByRole('listitem').filter({ has: getByRole('button', { name: 'Images', exact: true }) }).getByRole('textbox', { name: 'Images guidelines' })
Expected: "Always include descriptive alt text."
Received: ""
Timeout:  5000ms

Call log:
  - Expect "toHaveValue" getByRole('listitem').filter({ has: getByRole('button', { name: 'Images', exact: true }) }).getByRole('textbox', { name: 'Images guidelines' }) with timeout 5000ms
  - waiting for getByRole('listitem').filter({ has: getByRole('button', { name: 'Images', exact: true }) }).getByRole('textbox', { name: 'Images guidelines' })
    14 × locator resolved to <textarea rows="4" id="base-ui-_r_f_" aria-labelledby="base-ui-_r_g_" class="_547d86373d02e108__textarea _414844876c32ecee__textarea d2cff2e5dea83bd1__input _2ae7be2fc1bb17a3__input"></textarea>
       - unexpected value ""

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/admin/guidelines.spec.js:290:5
refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 1
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "curies": [{"href": "https://api.w.org/{rel}", "name": "wp", "templated": true}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=223"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/223", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}], "wp:attached-to": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/posts/222", "id": 222, "post_type": "post"}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-223", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-10-20T13:40:46", "date_gmt": "2026-10-20T13:40:46", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/78da14b5-34e3-4131-8dbb-dc1d366bd32b.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/78da14b5-34e3-4131-8dbb-dc1d366bd32b.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "78da14b5-34e3-4131-8dbb-dc1d366bd32b.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/78da14b5-34e3-4131-8dbb-dc1d366bd32b.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/78da14b5-34e3-4131-8dbb-dc1d366bd32b.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-10-20T13:40:46", "modified_gmt": "2026-10-20T13:40:46", "ping_status": "closed", "post": 222, "slug": "78da14b5-34e3-4131-8dbb-dc1d366bd32b", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/78da14b5-34e3-4131-8dbb-dc1d366bd32b.png", "status": "inherit", "template": "", "title": {"rendered": "78da14b5-34e3-4131-8dbb-dc1d366bd32b"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45

a36c42e Run

@aaronrobertshaw
aaronrobertshaw force-pushed the fix/site-title-fit-text-white-space branch from 4524c66 to a36c42e Compare October 20, 2026 13:25
@aaronrobertshaw
aaronrobertshaw marked this pull request as ready for review October 20, 2026 14:15

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Words in editor and frontend. Can't detect any regressions

Trunk PR
Image Image

@aaronrobertshaw
aaronrobertshaw merged commit f6c192d into trunk Oct 21, 2026
113 of 115 checks passed
@aaronrobertshaw
aaronrobertshaw deleted the fix/site-title-fit-text-white-space branch October 21, 2026 03:48
@github-actions github-actions Bot added this to the Gutenberg 24.4 milestone Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Site Title Affects the Site Title Block [Package] Block library /packages/block-library [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants