Skip to content

Block Library: Show media type icons in the inspector media control - #86170

Merged
im3dabasia merged 2 commits into
trunkfrom
update/media-control-type-icons
Nov 25, 2026
Merged

im3dabasia merged 2 commits into
trunkfrom
update/media-control-type-icons

Conversation

@im3dabasia

Copy link
Copy Markdown
Contributor

Part of #66563. Follows the design in #66563 (comment).

What?

  • The media control in the block inspector now shows a + when no media is set.
  • Once media is set, it shows the image thumbnail, or an icon for audio, video, and other files.
  • Cover and Media & Text pass their media type, so a video no longer shows an empty thumbnail.

Why?

Blocks without an image preview, like Video and Audio, left an empty box beside the label.

Testing Instructions

  1. Add an Image block and open the block settings: the media control shows a +.
  2. Choose an image: the thumbnail appears.
  3. Add a Cover block with a video background: the media control shows a video icon.
  4. Add a Media & Text block with a video: the media control shows a video icon.

Screenshots

Screen.Recording.2026-11-02.at.2.18.47.PM.mov

cc @WordPress/gutenberg-design for a quick visual check.

@im3dabasia im3dabasia self-assigned this Nov 2, 2026
@im3dabasia im3dabasia added [Type] Enhancement A suggestion for improvement. [Feature] Media Anything that impacts the experience of managing media labels Nov 2, 2026
@im3dabasia
im3dabasia requested a review from a team November 2, 2026 08:49
@im3dabasia im3dabasia added the Needs Design Feedback Needs general design feedback. label Nov 2, 2026
@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 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: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: fcoveram <fcoveram@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.

📦 Bundle size

Size Change: +301 B (0%)

Total Size: 8.66 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 427 kB +195 B (+0.05%)
build/styles/block-library/editor-rtl.css 12.9 kB +25 B (+0.19%)
build/styles/block-library/editor-rtl.min.css 10.6 kB +28 B (+0.26%)
build/styles/block-library/editor.css 13 kB +25 B (+0.19%)
build/styles/block-library/editor.min.css 10.6 kB +28 B (+0.26%)

1b74e07 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 81e691b trunk % Change
timeToFirstByte 56.2 ms +11.12% -3.56% 56.95 ms +5.36% -3.16% -1.32%
largestContentfulPaint 88 ms +9.09% -4.55% 88 ms +4.55% -4.55% 0%
lcpMinusTtfb 29.85 ms +24.96% -6.7% 29.55 ms +8.97% -5.75% 1.02%
wpBeforeTemplate 29.9 ms +12.14% -3.65% 29.79 ms +12.86% -2.28% 0.37%
wpTemplate 21.94 ms +4.79% -1.37% 22.43 ms +3.21% -4.19% -2.18%
wpTotal 52.49 ms +10.19% -3.77% 53.09 ms +5.58% -3.2% -1.13%
wpMemoryUsage 7.75 MB +0% -0% 7.71 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 81e691b trunk % Change
timeToFirstByte 47.8 ms +7.01% -3.14% 47.4 ms +5.27% -1.9% 0.84%
largestContentfulPaint 84 ms +7.14% -4.76% 84 ms +0% -4.76% 0%
lcpMinusTtfb 35.65 ms +5.47% -3.51% 34.65 ms +5.63% -3.46% 2.89%
wpBeforeTemplate 27.43 ms +9.11% -2.77% 27.15 ms +2.1% -1.07% 1.03%
wpTemplate 16.47 ms +5.65% -2.49% 16.59 ms +3.01% -3.19% -0.72%
wpTotal 44.28 ms +8.31% -3% 43.79 ms +4.48% -1.12% 1.12%
wpMemoryUsage 6.44 MB +0% -0% 6.40 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric 81e691b trunk % Change
mediaProcessingJpeg 407.71 ms +0.33% -0.69% 404.73 ms +1.07% -0.91% 0.74%
mediaProcessingAvif 6167.79 ms +0.32% -0.5% 6188.68 ms +0.45% -0.17% -0.34%
mediaProcessingJpegToAvif 4250.85 ms +0.23% -0.43% 4248.85 ms +0.17% -0.23% 0.05%

media-upload

Metric 81e691b trunk % Change
jpegUploadProcessing 1992.86 ms +2.02% -21.35% 1745.38 ms +13.62% -13.94% 14.18%
pngUploadProcessing 272.19 ms +3.57% -0.74% 276.2 ms +4.11% -10.54% -1.45%
largeJpegUploadProcessing 1979.28 ms +0.61% -0.85% 1761.7 ms +12.49% -14.46% 12.35%
multipleImageUploadProcessing 2072.03 ms +1.01% -0.13% 2075.21 ms +0.87% -0.53% -0.15%

post-editor

Metric 81e691b trunk % Change
serverResponse 385.51 ms +4.23% -4.04% 401.57 ms +1.79% -5.03% -4%
firstPaint 414.49 ms +2.63% -2.75% 373.41 ms +3.52% -1.99% 11%
domContentLoaded 746.17 ms +1.01% -0.75% 746.54 ms +1.07% -1.37% -0.05%
loaded 747.05 ms +1.01% -0.73% 747.52 ms +1.06% -1.36% -0.06%
firstContentfulPaint 422.03 ms +0.88% -4.2% 417.06 ms +2.71% -2.47% 1.19%
firstBlock 1972.58 ms +0.8% -1.51% 1952.29 ms +1.71% -0.85% 1.04%
type 15.29 ms +5.89% -6.74% 15.33 ms +12.65% -8.81% -0.26%
typeWithoutInspector 15.45 ms +6.47% -9.77% 16.55 ms +2.24% -15.53% -6.65%
typeWithTopToolbar 19.88 ms +5.28% -9.71% 21.62 ms +6.71% -11.19% -8.05%
typeContainer 7.54 ms +18.17% -8.36% 7.59 ms +3.56% -14.89% -0.66%
focus 112.06 ms +5.31% -4.1% 110.32 ms +6.16% -4.92% 1.58%
firstFocus 226.48 ms +0% -0% 234.4 ms +0% -0% -3.38%
selectAll 332.91 ms +0.66% -1.47% 329.06 ms +6.68% -1.19% 1.17%
undo 28.18 ms +4.4% -6.71% 28.53 ms +2.94% -7.54% -1.23%
listViewOpen 74.82 ms +6.17% -6.88% 71.57 ms +5.81% -6.93% 4.54%
inserterOpen 41.68 ms +16.51% -10.48% 40.1 ms +4.91% -3.47% 3.94%
inserterHover 10.91 ms +4.77% -8.89% 10.67 ms +10.78% -2.25% 2.25%
inserterSearch 8.45 ms +12.9% -8.88% 8.09 ms +5.81% -6.8% 4.45%
loadPatterns 628.98 ms +9.06% -2.23% 621.06 ms +7.32% -4.78% 1.28%
wpTotal 376.12 ms +4.35% -4.11% 392.53 ms +1.59% -5.2% -4.18%
wpMemoryUsage 14.81 MB +0% -0% 14.77 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 81e691b trunk % Change
serverResponse 476.04 ms +3.26% -4.72% 462.81 ms +1.08% -8.42% 2.86%
firstPaint 454.1 ms +8.89% -11.56% 395.31 ms +8.19% -1.71% 14.87%
domContentLoaded 864.94 ms +1.42% -2.2% 820.01 ms +1.2% -0.68% 5.48%
loaded 866.2 ms +1.42% -2.2% 821.08 ms +1.18% -0.65% 5.5%
firstContentfulPaint 482.99 ms +2.38% -4.04% 460.49 ms +0.64% -2.7% 4.89%
firstBlock 2684.46 ms +5.46% -0.75% 2520.75 ms +0.99% -1.2% 6.49%
type 20.34 ms +9.34% -10.18% 17.08 ms +4.33% -12% 19.09%
navigate 122.38 ms +7.46% -3.02% 108.23 ms +7.55% -4.23% 13.07%
loadPatterns 1501.65 ms +6.74% -1.77% 1325.36 ms +7.97% -7.84% 13.3%
loadPages 944.99 ms +3.95% -2.01% 950.59 ms +2.41% -3.63% -0.59%
wpTotal 466.53 ms +3.29% -4.82% 453.34 ms +1.11% -8.59% 2.91%
wpMemoryUsage 12.82 MB +0% -0% 12.79 MB +0% -0% 0.25%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

1b74e07 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.

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": 1,
+   "offset": 1,
  }

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
should reset a named font size using input field in /test/e2e/specs/editor/various/font-size-picker.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:paragraph {"fontSize":"small"} -->
+ <!-- wp:paragraph {"fontSize":"tiny"} -->
- <p class="has-small-font-size">Paragraph with font size reset using input field</p>
+ <p class="has-tiny-font-size">Paragraph with font size reset using input field</p>
  <!-- /wp:paragraph -->

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/font-size-picker.spec.js:216:6
should select synced pattern in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(locator).toBeFocused() failed

Locator:  locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
Expected: focused
Received: inactive
Timeout:  5000ms

Call log:
  - Expect "toBeFocused" locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]') with timeout 5000ms
  - waiting for locator('[name="editor-canvas"]').contentFrame().locator('[data-type="core/block"]')
    14 × locator resolved to <div tabindex="0" role="document" draggable="true" data-title="Pattern" data-type="core/block" data-is-drop-zone="true" aria-label="Block: Pattern" id="block-6f58f204-6dd9-4e63-b695-6053dcc4460b" data-block="6f58f204-6dd9-4e63-b695-6053dcc4460b" class="block-editor-block-list__block wp-block is-selected is-reusable block-library-block__reusable-block-container wp-block-block block-editor-block-list__layout">…</div>
       - unexpected value "inactive"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:1464:5

1b74e07 Run

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Hi @t-hamano @jameskoster @jasmussen,

When you have a moment, could you please review this PR? I've worked on what was discussed in this comment: #66563 (comment)

I'd appreciate your feedback on this.

@jasmussen
jasmussen requested a review from fcoveram November 10, 2026 11:32
@jameskoster

Copy link
Copy Markdown
Contributor

I'd still like to see alignment with the Set featured image button since these elements are all serving the same purpose.

I'd also like to see some indication that files can be dropped onto the control to upload/replace. That interaction is entirely opaque currently and it doesn't feel safe to rely on users assuming drag/drop support. It can be a dashed outline, visible text, or some other idea. It could even be built with EmptyState e.g.:

Image

Without catering to these points the solutions feels incomplete. Which is maybe fine; they can always be tackled later.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Drag and drop already works, @t-hamano demoed it here, so the gap is a static hint, not the interaction.

Happy to add the dashed outline or whichever you prefer. Could we ship this as is and improve from there? The featured image alignment feels like its own issue.

Happy to hear what others think on this?

@jameskoster

Copy link
Copy Markdown
Contributor

Shipping and iterating is fine imo 👍

@jameskoster

Copy link
Copy Markdown
Contributor

Noting #86732 is related.

@fcoveram

Copy link
Copy Markdown
Contributor

I'd still like to see alignment with the Set featured image button since these elements are all serving the same purpose.

Agree with this. It's the same sentiment I wanted to communicate in #66563 conversation.

Where I disagree is that dashed border communicates the drag-and-drop interaction. The same interaction in an image via image block does not have any visual indicator for this. So I would not say there is a consistent language for this interaction.

However, I like the idea of a text, but it seems this is a help text, and therefore, outside and below the container.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Thanks both. @t-hamano would you be able to take a look when you have a moment?

Two points are still open, and I'd suggest handling them as follow-ups rather than here. Happy to open issues for both once this ships:

  • The drop affordance, dashed outline, text, and EmptyState have all been suggested, most recently help text below the control.
  • Aligning with the Set featured image control.

@im3dabasia
im3dabasia requested a review from t-hamano November 17, 2026 10:21
@im3dabasia im3dabasia removed the Needs Design Feedback Needs general design feedback. label Nov 17, 2026
@jameskoster

Copy link
Copy Markdown
Contributor

Where I disagree is that dashed border communicates the drag-and-drop interaction. The same interaction in an image via image block does not have any visual indicator for this. So I would not say there is a consistent language for this interaction.

The image block doesn't need a visual affordance because the text in the placeholder already informs the user they can drop files. The issue is when there isn't text. I think the UI should somehow indicate users can drop files otherwise they have to guess. So it's a choice; add the text, or add some visual affordance (could be a dashed border, could be something else).

@github-actions
github-actions Bot requested review from aduth and ciampo November 17, 2026 13:21

@t-hamano t-hamano 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.

It looks good to me from a code perspective. Please just confirm whether the following changes are intentional from a design standpoint.

before-after

Comment on lines +28 to +31
const MEDIA_TYPE_ICONS = {
audio: audioIcon,
video: videoIcon,
};

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.

Currently, no block passes audio (or a non-image/video type that falls back to fileIcon) to MediaControl. Is this in preparation for adding the Media section to the Audio, Video, and File blocks in the future?

@im3dabasia im3dabasia Nov 17, 2026 •

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.

Yes, Aki. I added this intentionally with future PRs in mind. If you feel it doesn't look right at the moment, I can remove it now and we can add it back later.

@fcoveram

Copy link
Copy Markdown
Contributor

The image block doesn't need a visual affordance because the text in the placeholder already informs the user they can drop files. The issue is when there isn't text.

Good point. #86732 seems a better place to continue the pattern discussion. I see the evolution of this consuming the outcome of that work.

Regarding the before and after image attached by @t-hamano, it looks correct to me

@t-hamano t-hamano 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.

I think this looks good for now. In the future, we might be able to update the design as shown in #86732 (comment).

@im3dabasia
im3dabasia merged commit 196573f into trunk Nov 25, 2026
95 of 96 checks passed
@im3dabasia
im3dabasia deleted the update/media-control-type-icons branch November 25, 2026 04:00
@github-actions github-actions Bot added this to the Gutenberg 24.6 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Media Anything that impacts the experience of managing media [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.

4 participants