Skip to content

Image: Add border style support - #86733

Merged
aaronrobertshaw merged 1 commit into
trunkfrom
add/image-border-style-support
Nov 13, 2026
Merged

aaronrobertshaw merged 1 commit into
trunkfrom
add/image-border-style-support

Conversation

@aaronrobertshaw

@aaronrobertshaw aaronrobertshaw commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Related:

What?

Adds a border style control (solid, dashed, dotted) to the Image block.

Why?

Image has border color, radius and width but no style. Themes such as Twenty Twenty-One override the solid fallback, so a border without a style does not show (#47401). Post Featured Image already has the control (#83956).

How?

Adds style to __experimentalBorder in block.json, outside the default controls, as in #83956.

The editor and save already pass style through. Saved markup without a style is unchanged.

Testing Instructions

  1. Add an Image block with a caption. It renders as before.
  2. Global Styles > Blocks > Image: border 2px solid #1e1e1e, radius 4px.
    • Shows in the editor and on the front end.
  3. Global Styles, Mobile state: border 4px dotted, radius 0px.
    • Editor: View > Responsive styles > Mobile.
    • Front end: mobile width.
  4. Block inspector: border 6px dashed #3858e9, radius 16px.
    • Wins at every width: a block value has no mobile state of its own and still outranks Global Styles.
    • Remove the image: the placeholder shows the border too.
  5. Block inspector, Mobile selected: border 8px solid, radius 24px.
    • Wins at a mobile width. The screenshot uses double, set in the Code editor.
  6. Turn on "Expand on click" and check the border in the lightbox.
  7. Twenty Twenty-One has no Border panel, so use the Code editor. With color and width only, the front end hides the border, as on trunk. Add "style":"solid" and it shows.

Screenshots or screencast

image-border-style

Use of AI Tools

Written with Claude Code, then reviewed and tested.

@aaronrobertshaw aaronrobertshaw added [Type] Enhancement A suggestion for improvement. [Package] Block library /packages/block-library [Block] Image Affects the Image Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Nov 12, 2026
@aaronrobertshaw aaronrobertshaw self-assigned this Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 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: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

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

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 501fab8 trunk % Change
timeToFirstByte 56.05 ms +7.23% -3.66% 56.2 ms +4.8% -4.72% -0.27%
largestContentfulPaint 92 ms +4.35% -8.7% 86 ms +11.63% -6.98% 6.98%
lcpMinusTtfb 30.7 ms +21.99% -2.93% 29.1 ms +31.44% -5.5% 5.5%
wpBeforeTemplate 29.54 ms +9.99% -1.9% 29.24 ms +13.17% -3.21% 1.03%
wpTemplate 22.36 ms +4.38% -4.03% 22.26 ms +4.31% -5.17% 0.45%
wpTotal 51.98 ms +8.08% -3.25% 52.49 ms +3.14% -4.61% -0.97%
wpMemoryUsage 7.72 MB +0% -0% 7.69 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 501fab8 trunk % Change
timeToFirstByte 46.75 ms +6.2% -1.5% 47.1 ms +6.26% -3.4% -0.74%
largestContentfulPaint 84 ms +2.38% -2.38% 80 ms +5% -0% 5%
lcpMinusTtfb 37.25 ms +1.74% -7.79% 34.5 ms +1.74% -2.17% 7.97%
wpBeforeTemplate 26.83 ms +4.73% -1.75% 26.57 ms +7.3% -1.88% 0.98%
wpTemplate 16.65 ms +4.2% -0.9% 16.45 ms +3.77% -2.49% 1.22%
wpTotal 43.82 ms +3.38% -1.87% 43.6 ms +7.45% -2.8% 0.5%
wpMemoryUsage 6.41 MB +0% -0% 6.38 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 501fab8 trunk % Change
mediaProcessingJpeg 403.01 ms +2.36% -0.15% 402.33 ms +1.65% -0.64% 0.17%
mediaProcessingAvif 6164.45 ms +0.37% -0.32% 6145.61 ms +0.18% -0.37% 0.31%
mediaProcessingJpegToAvif 4240.79 ms +0.06% -0.18% 4235.09 ms +0.2% -0.34% 0.13%

media-upload

Metric 501fab8 trunk % Change
jpegUploadProcessing 2004.94 ms +1.9% -2.05% 1756.92 ms +13.28% -13.5% 14.12%
pngUploadProcessing 285.51 ms +2.76% -4.01% 275.69 ms +0.65% -2.22% 3.56%
largeJpegUploadProcessing 1526.3 ms +31.08% -0.79% 1747.45 ms +13.36% -13.38% -12.66%
multipleImageUploadProcessing 2122.04 ms +0.43% -1.77% 2084.52 ms +0.37% -0.14% 1.8%

post-editor

Metric 501fab8 trunk % Change
serverResponse 263.27 ms +3.27% -12.28% 266.66 ms +5.88% -8.69% -1.27%
firstPaint 284.01 ms +7.74% -6.38% 304.32 ms +4.48% -11.1% -6.67%
domContentLoaded 521.83 ms +12.1% -1.22% 563.44 ms +5.6% -1.84% -7.38%
loaded 522.52 ms +12.09% -1.22% 564.21 ms +5.64% -1.81% -7.39%
firstContentfulPaint 303.23 ms +15.91% -2% 328.12 ms +3.83% -5.8% -7.59%
firstBlock 1398.06 ms +4.07% -2.57% 1507.81 ms +3.33% -1.82% -7.28%
type 12.8 ms +7.27% -10.55% 13.48 ms +4.97% -11.35% -5.04%
typeWithoutInspector 13.11 ms +11.82% -11.21% 15.36 ms +6.9% -13.87% -14.65%
typeWithTopToolbar 16.44 ms +4.68% -8.39% 18.66 ms +4.93% -5.79% -11.9%
typeContainer 6.11 ms +7.53% -12.44% 6.71 ms +4.92% -10.58% -8.94%
focus 84.48 ms +3.8% -7.23% 86.81 ms +3.95% -4.17% -2.68%
firstFocus 168.94 ms +0% -0% 190.33 ms +0% -0% -11.24%
selectAll 257.48 ms +8.92% -4.05% 258.52 ms +2.81% -1.83% -0.4%
undo 20.83 ms +5.52% -7.92% 23.07 ms +8.76% -3.25% -9.71%
listViewOpen 47.4 ms +7.49% -6.33% 48.1 ms +7.09% -7.92% -1.46%
inserterOpen 29.48 ms +6.24% -8.04% 32.97 ms +9.28% -3.4% -10.59%
inserterHover 8.5 ms +15.65% -6.24% 9.52 ms +13.03% -7.98% -10.71%
inserterSearch 6.56 ms +11.74% -7.62% 7.1 ms +13.1% -9.58% -7.61%
loadPatterns 430.34 ms +4.61% -2.47% 476.24 ms +4.12% -1.29% -9.64%
wpTotal 256.37 ms +2.99% -12.56% 259.78 ms +5.67% -8.98% -1.31%
wpMemoryUsage 14.78 MB +0% -0% 14.74 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 501fab8 trunk % Change
serverResponse 402.43 ms +2.74% -10.05% 402.99 ms +1.49% -5.34% -0.14%
firstPaint 449.23 ms +1.82% -7.74% 427.28 ms +12.09% -6.06% 5.14%
domContentLoaded 840.02 ms +2.41% -3.19% 837.92 ms +1.96% -1.04% 0.25%
loaded 841.05 ms +2.42% -3.19% 839.02 ms +1.97% -1.03% 0.24%
firstContentfulPaint 474.9 ms +5.81% -3.68% 477.79 ms +1.48% -2.4% -0.6%
firstBlock 2509.74 ms +2.31% -1.15% 2513.54 ms +0.82% -1.55% -0.15%
type 18.08 ms +4.59% -5.75% 18.39 ms +6.2% -7.67% -1.69%
navigate 114.06 ms +1.6% -4.26% 115.13 ms +9.25% -5.12% -0.93%
loadPatterns 1298.81 ms +7.79% -13.06% 1273.69 ms +6.65% -19.55% 1.97%
loadPages 921.34 ms +2.95% -1.32% 911.56 ms +1.53% -0.3% 1.07%
wpTotal 391.53 ms +2.86% -10.26% 392.33 ms +1.51% -5.53% -0.2%
wpMemoryUsage 12.79 MB +0% -0% 12.76 MB +0% -0% 0.24%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

16c191a 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.

Should duplicate the widgets in /test/e2e/specs/widgets/editing-widgets.spec.js, passed after 1 failed attempt.

Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
does not select blocks in the canvas preview when editing from the sidebar (Site Editor v2) in /test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeVisible() failed

Locator: getByRole('listbox', { name: 'Search results' })
Expected: visible
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" getByRole('listbox', { name: 'Search results' }) with timeout 5000ms
  - waiting for getByRole('listbox', { name: 'Search results' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:423:33)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:3

16c191a Run

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Testing nicely for me in global styles, at the individual block level, and with responsive styles editing mode:

image

LGTM! 🚀

@aaronrobertshaw
aaronrobertshaw merged commit d8cfce1 into trunk Nov 13, 2026
99 checks passed
@aaronrobertshaw
aaronrobertshaw deleted the add/image-border-style-support branch November 13, 2026 01:44
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Image Affects the Image Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image and post featured image are missing border style control

2 participants