Skip to content

[WP 7.2] Edit as HTML: Show design system focus ring on the HTML textarea - #85359

Merged
ciampo merged 2 commits into
wp/7.2from
codex/backport-85266-wp-7-2
Oct 22, 2026
Merged

ciampo merged 2 commits into
wp/7.2from
codex/backport-85266-wp-7-2

Conversation

@ciampo

@ciampo ciampo commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Backport of #85266 to wp/7.2, following the failed automatic cherry-pick.

What?

Show the design system's focus outline on the "Edit as HTML" textarea in WordPress 7.2.

Why?

The existing box-shadow focus indicator disappears in forced-colors mode.

How?

Cherry-pick 2d367b8c844dc68b46b672d552617fdbdd7125b3 with the CSS unchanged. Resolve the changelog conflict by adding the original entry under Unreleased, preserving the release branch's existing entries.

Testing Instructions

  1. Open a post and add a Paragraph block.
  2. Open the block's Options menu and choose Edit as HTML.
  3. Focus the textarea, then hover the block. A single focus ring should remain inside the textarea.
  4. Emulate forced-colors: active in browser DevTools. The focused textarea's outline should remain visible.

Testing Instructions for Keyboard

  1. Select a Paragraph block and move focus to its toolbar.
  2. Use the keyboard to open the Options menu and choose Edit as HTML.
  3. Focus the textarea and confirm that its focus outline is visible in normal and forced-colors modes.

Screenshots or screencast

See the before/after screenshots in #85266.

Verification

The production build, CSS lint, and changelog validation passed. An isolated Chromium check using the release branch's compiled textarea styles reproduced the missing indicator before the backport and verified the inset outline afterward in normal and forced-colors modes. The full WordPress editor flow has not been rerun.

Use of AI Tools

Codex prepared this manual backport, resolved the changelog conflict, and ran verification.

)

* Edit as HTML: Show design system focus ring on the block HTML textarea

* Edit as HTML: Add changelog entry

---

Co-authored-by: R1shabh-Gupta <rishabhwp@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
(cherry picked from commit 2d367b8)
@github-actions

github-actions Bot commented Oct 21, 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: R1shabh-Gupta <rishabhwp@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: mirka <0mirka00@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: 0 B

Total Size: 9.04 MB

c742b12 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 273e13b wp/7.2 % Change
timeToFirstByte 39.05 ms +16.39% -6.53% 39.45 ms +12.67% -9% -1.01%
largestContentfulPaint 70 ms +2.86% -8.57% 70 ms +2.86% -11.43% 0%
lcpMinusTtfb 27.15 ms +8.29% -4.42% 26.85 ms +11.73% -6.52% 1.12%
wpBeforeTemplate 20.42 ms +21.45% -6.02% 21.68 ms +12.27% -12.41% -5.81%
wpTemplate 14.89 ms +12.63% -10.88% 14.67 ms +5.79% -10.97% 1.5%
wpTotal 35.78 ms +16.88% -6.79% 36.23 ms +11.01% -9.49% -1.24%
wpMemoryUsage 7.66 MB +0% -0% 7.63 MB +0% -0% 0.42%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 273e13b wp/7.2 % Change
timeToFirstByte 31.3 ms +5.75% -3.04% 32.45 ms +4.78% -3.7% -3.54%
largestContentfulPaint 72 ms +0% -5.56% 72 ms +5.56% -5.56% 0%
lcpMinusTtfb 39.8 ms +2.01% -3.52% 39.3 ms +6.87% -3.31% 1.27%
wpBeforeTemplate 17.23 ms +16.54% -3.19% 17.45 ms +11.23% -3.09% -1.26%
wpTemplate 10.95 ms +3.56% -4.2% 11.33 ms +6.8% -8.3% -3.35%
wpTotal 28.63 ms +5.59% -3.56% 29.7 ms +5.19% -4.18% -3.6%
wpMemoryUsage 6.35 MB +0% -0% 6.32 MB +0% -0% 0.52%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 273e13b wp/7.2 % Change
mediaProcessingJpeg 232.51 ms +3% -2.26% 227.2 ms +1.23% -1.33% 2.34%
mediaProcessingAvif 3788.77 ms +0.44% -0.45% 3723.41 ms +0.61% -1.06% 1.76%
mediaProcessingJpegToAvif 2629.59 ms +0.49% -2.13% 2574.13 ms +0.28% -0.9% 2.15%

media-upload

Metric 273e13b wp/7.2 % Change
jpegUploadProcessing 1374.03 ms +2.44% -33.67% 1387.1 ms +2.01% -32.57% -0.94%
pngUploadProcessing 160.67 ms +13.78% -1.15% 158.57 ms +2.48% -0.64% 1.32%
largeJpegUploadProcessing 1402.62 ms +1.49% -31.4% 914.85 ms +50.95% -1.7% 53.32%
multipleImageUploadProcessing 1487.46 ms +1.22% -0.51% 1423.68 ms +2.17% -28.18% 4.48%

post-editor

Metric 273e13b wp/7.2 % Change
serverResponse 268.9 ms +4.69% -4.73% 266.07 ms +3.63% -6.22% 1.06%
firstPaint 193.45 ms +70.57% -23.5% 335.71 ms +2.29% -8.32% -42.38%
domContentLoaded 739.05 ms +2.7% -2.8% 723.25 ms +3.01% -1.84% 2.18%
loaded 739.82 ms +2.68% -2.79% 724.01 ms +3% -1.84% 2.18%
firstContentfulPaint 338.38 ms +3.32% -2.49% 337.11 ms +4.16% -1.56% 0.38%
firstBlock 2255.42 ms +2.41% -1.71% 2170.31 ms +3.21% -0.79% 3.92%
type 12.99 ms +6.08% -2.62% 13.26 ms +4.07% -0.75% -2.04%
typeWithoutInspector 13.61 ms +3.89% -1.1% 13.34 ms +1.5% -2.32% 2.02%
typeWithTopToolbar 15.77 ms +3.11% -2.09% 17.3 ms +2.89% -1.97% -8.84%
typeContainer 6.03 ms +10.45% -5.31% 6.68 ms +4.19% -4.94% -9.73%
focus 76.47 ms +1.88% -1.35% 74.42 ms +7.77% -6.46% 2.75%
firstFocus 142.94 ms +0% -0% 141.06 ms +0% -0% 1.33%
selectAll 330.69 ms +1.48% -2.25% 369.34 ms +1.02% -0.22% -10.46%
listViewOpen 48.08 ms +5.49% -5.95% 46.98 ms +7.51% -6.17% 2.34%
inserterOpen 27.42 ms +2.01% -1.93% 27.41 ms +11.89% -4.93% 0.04%
inserterHover 8.72 ms +6.88% -6.08% 8.97 ms +10.37% -4.79% -2.79%
inserterSearch 6.07 ms +6.1% -4.12% 6.31 ms +9.03% -3.96% -3.8%
loadPatterns 431.67 ms +4.77% -2.01% 437.09 ms +1.99% -3.23% -1.24%
wpTotal 261.91 ms +4.39% -5.12% 258.83 ms +3.77% -6.4% 1.19%
wpMemoryUsage 14.67 MB +0% -0% 14.66 MB +0% -0% 0.09%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 273e13b wp/7.2 % Change
serverResponse 266.65 ms +8.91% -6.75% 281.7 ms +4.36% -12.58% -5.34%
firstPaint 200.98 ms +40.1% -29.95% 187.3 ms +9.99% -8.79% 7.3%
domContentLoaded 829.04 ms +5.02% -1.76% 837.56 ms +2.3% -5.4% -1.02%
loaded 829.94 ms +5.05% -1.77% 838.3 ms +2.33% -5.38% -1%
firstContentfulPaint 363.66 ms +6.47% -2.21% 349.52 ms +5.73% -2.53% 4.05%
firstBlock 3141.45 ms +2.21% -2.29% 3109.91 ms +1.11% -1.47% 1.01%
type 15.37 ms +2.67% -2.86% 13.71 ms +4.01% -2.92% 12.11%
navigate 98.13 ms +10.44% -10.85% 77.62 ms +10.63% -4.69% 26.42%
loadPatterns 933.89 ms +14.02% -3.22% 855.39 ms +32.8% -6.94% 9.18%
loadPages 998.97 ms +4.94% -2.79% 999.66 ms +5.91% -3.77% -0.07%
wpTotal 259.93 ms +9.04% -6.98% 274.93 ms +4.3% -12.97% -5.46%
wpMemoryUsage 12.71 MB +0% -0% 12.67 MB +0% -0% 0.27%
wpDbQueries 44.5 +1.12% -1.12% 44 +2.27% -0% 1.14%

c742b12 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
keeps the blocks selected after dropping a multi-selection in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:908:3
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-21T22:52:14", "date_gmt": "2026-10-21T22:52:14", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/10/3394684e-8da3-479f-9caa-f7a51fa4da72.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/10/3394684e-8da3-479f-9caa-f7a51fa4da72.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "3394684e-8da3-479f-9caa-f7a51fa4da72.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/10/3394684e-8da3-479f-9caa-f7a51fa4da72.png"}, "id": 223, "link": "http://localhost:8889/?attachment_id=223", "media_details": {"file": "2026/10/3394684e-8da3-479f-9caa-f7a51fa4da72.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-21T22:52:14", "modified_gmt": "2026-10-21T22:52:14", "ping_status": "closed", "post": 222, "slug": "3394684e-8da3-479f-9caa-f7a51fa4da72", "source_url": "http://localhost:8889/wp-content/uploads/2026/10/3394684e-8da3-479f-9caa-f7a51fa4da72.png", "status": "inherit", "template": "", "title": {"rendered": "3394684e-8da3-479f-9caa-f7a51fa4da72"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45
restores the blocks when a multi-selection drag is canceled in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
TypeError: Cannot read properties of null (reading 'y')
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:824:57
    at dragSelectionBelowLanding (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:823:3)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:871:3
should cut and paste individual blocks with collapsed selection in /test/e2e/specs/editor/various/copy-cut-paste.spec.js, passed after 1 failed attempt.
Error: expect(string).toMatchSnapshot(expected) failed

  @@ -1,3 +1,3 @@
   <!-- wp:paragraph -->
  -<p>2Cut - collapsed selection</p>
  +<p>2</p>
   <!-- /wp:paragraph -->


    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/copy-cut-paste.spec.js:45:49

From f515987, not the current head. Run

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Oct 21, 2026
@ciampo ciampo self-assigned this Oct 21, 2026
@ciampo
ciampo requested a review from a team October 21, 2026 22:40
@ciampo
ciampo marked this pull request as ready for review October 21, 2026 22:40
@ciampo
ciampo requested a review from ellatrix as a code owner October 21, 2026 22:40
&:focus {
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@include outset-ring__focus();
outline-offset: calc(-1 * var(--wpds-border-width-focus));

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.

The backport is fine, but I wouldn't recommend this override in combination with the outset-ring mixin. It literally says outset in the name. This is exactly the kind of thing that breaks when the underlying mixin changes between box-shadow/outline implementations.

I think it would be safer for this to set its own focus ring styles using the tokens directly. (This is separate from the fact that we could reconsider the non-outset style here to begin with. There's a reason we're outsetting, and this textarea seems to be something that could perhaps benefit from outsetting and using the standard textarea border color IMO. It isn't visually clear that this is a focused textarea, especially within the rules of the system. If not, we should perhaps consider adding a new focus mixin that isn't outset.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can't find where, but I remember suggesting that we have an equivalent inset mixin, or at least that we add an argument to the mixin to tweak that aspect. I think we're going to need this tweak in a few places, and I'm afraid that going "custom styles" will cause these styles to diverge over time

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.

Yeah, I think the decision tree would be like:

  1. Reconsider whether the use case really can't use the standard outset.
  2. Use a separate mixin †.

† Not sure exactly what mixins would be common enough to create. An argument mixin might lead to random arbitrary offsets, so we should tread carefully in any case!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved to #85400

@ciampo ciampo added [Type] Task Issues or PRs that have been broken down into an individual action to take [Type] Enhancement A suggestion for improvement. and removed [Type] Task Issues or PRs that have been broken down into an individual action to take labels Oct 22, 2026
@ciampo
ciampo merged commit 056861c into wp/7.2 Oct 22, 2026
44 checks passed
@ciampo
ciampo deleted the codex/backport-85266-wp-7-2 branch October 22, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants