Skip to content

Video Block: Add a Media section and a setup-state toolbar option - #84602

Merged
im3dabasia merged 9 commits into
trunkfrom
add/video-block-media-panel
Dec 3, 2026
Merged

im3dabasia merged 9 commits into
trunkfrom
add/video-block-media-panel

Conversation

@im3dabasia

@im3dabasia im3dabasia commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What?

See #66563.

Video now offers media from the inspector and from the toolbar in its setup state, like Image, Cover, Media & Text and Site Logo.

Why?

- The toolbar only appeared once a video was set, so it could replace but never add.
- The inspector had no Media section at all.

How?

  • Lifts the toolbar and Media panel above the setup-state early return, as #82420 did for Media & Text
  • Toolbar reads "Add video" when empty, "Replace" once set
  • Panel uses the Content group and MediaControl, matching the blocks that already have it

Testing Instructions

  1. Insert a Video block and select it without adding media.
  2. The toolbar shows Add video, and the inspector shows a Media section with the same.
  3. Add a video from either, the canvas updates and the filename appears.
  4. Confirm Reset clears it and the toolbar then reads Replace.

Screencast

Screen.Recording.2026-10-13.at.1.08.12.PM.mov

Open questions

  • Happy to add an e2e spec or the browser tests if that's wanted.

Follow-ups

On the duplication

cc @WordPress/gutenberg-design

Use of AI Tools

Claude Code. I reviewed and tested the change and take responsibility for it.

@im3dabasia im3dabasia self-assigned this Oct 13, 2026
@im3dabasia im3dabasia added [Type] Enhancement A suggestion for improvement. [Block] Video Affects the Video Block labels Oct 13, 2026
@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Oct 13, 2026
@im3dabasia
im3dabasia requested review from a team and Mamaduka October 13, 2026 07:41
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🎉 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: jasmussen <joen@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: +129 B (0%)

Total Size: 8.85 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 432 kB +129 B (+0.03%)

14e896e Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric fe099a5 trunk % Change
timeToFirstByte 39.45 ms +6.46% -7.1% 37.35 ms +14.19% -5.49% 5.62%
largestContentfulPaint 64 ms +6.25% -6.25% 64 ms +0% -9.38% 0%
lcpMinusTtfb 22.9 ms +1.97% -7.21% 22.65 ms +13.25% -9.27% 1.1%
wpBeforeTemplate 20.2 ms +16.98% -4.5% 19.63 ms +15.94% -3.67% 2.9%
wpTemplate 14.45 ms +9.9% -2.42% 13.91 ms +8.55% -4.03% 3.88%
wpTotal 36.15 ms +6.56% -6.92% 33.81 ms +16.12% -4.79% 6.92%
wpMemoryUsage 7.76 MB +0% -0% 7.72 MB +0% -0% 0.45%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric fe099a5 trunk % Change
timeToFirstByte 32.1 ms +8.26% -1.56% 30.65 ms +9.95% -3.92% 4.73%
largestContentfulPaint 60 ms +6.67% -0% 56 ms +7.14% -0% 7.14%
lcpMinusTtfb 28.1 ms +2.85% -7.83% 25.6 ms +4.88% -5.66% 9.77%
wpBeforeTemplate 17.93 ms +16.45% -1.9% 17.29 ms +10.58% -2.89% 3.7%
wpTemplate 11.11 ms +4.68% -3.87% 10.52 ms +6.27% -3.71% 5.61%
wpTotal 29.29 ms +9.15% -1.57% 28.06 ms +10.44% -3.67% 4.38%
wpMemoryUsage 6.44 MB +0% -0% 6.41 MB +0% -0% 0.56%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric fe099a5 trunk % Change
mediaProcessingJpeg 236.34 ms +3.88% -2.2% 231.09 ms +0.4% -0.67% 2.27%
mediaProcessingAvif 3836 ms +0.36% -0.24% 3775.57 ms +0.4% -0.49% 1.6%
mediaProcessingJpegToAvif 2662.99 ms +0.78% -0.9% 2608.18 ms +2.48% -0.28% 2.1%

media-upload

Metric fe099a5 trunk % Change
jpegUploadProcessing 1454.64 ms +0.97% -1.57% 1460.78 ms +0.95% -1.47% -0.42%
pngUploadProcessing 196.94 ms +4.52% -2.55% 190.9 ms +5.29% -7.82% 3.16%
largeJpegUploadProcessing 1450.54 ms +0.73% -1.04% 1449.32 ms +1.56% -1.24% 0.08%
multipleImageUploadProcessing 1475.22 ms +0.85% -0.39% 1489.2 ms +1.13% -1.39% -0.94%

post-editor

Metric fe099a5 trunk % Change
serverResponse 378.52 ms +9.88% -1.24% 395.58 ms +4.22% -3.66% -4.31%
firstPaint 423.02 ms +12.68% -9.53% 438.08 ms +1.15% -8.15% -3.44%
domContentLoaded 821.99 ms +9.34% -3.65% 792.54 ms +0.9% -0.77% 3.72%
loaded 823.57 ms +9.34% -3.62% 794.28 ms +0.89% -0.76% 3.69%
firstContentfulPaint 465.22 ms +10.72% -5.23% 440.31 ms +0.83% -0.9% 5.66%
firstBlock 2141.03 ms +2.5% -1.82% 2079.43 ms +0.52% -1.65% 2.96%
type 17.54 ms +6.9% -10.26% 17.73 ms +4.91% -5.19% -1.07%
typeWithoutInspector 17.29 ms +10.87% -8.79% 17.48 ms +9.04% -7.15% -1.09%
typeWithTopToolbar 23.04 ms +4.9% -6.38% 22.89 ms +8.08% -7.03% 0.66%
typeContainer 8.24 ms +13.96% -6.55% 8.09 ms +6.43% -1.98% 1.85%
focus 111.37 ms +2.49% -2.83% 106.42 ms +3.73% -3.3% 4.65%
firstFocus 261.14 ms +0% -0% 253.61 ms +0% -0% 2.97%
selectAll 322.57 ms +0.1% -2.5% 323.52 ms +0.79% -0.19% -0.29%
undo 28.87 ms +7.2% -3.36% 30.11 ms +2.42% -3.69% -4.12%
listViewOpen 38.08 ms +4.62% -4.25% 37.01 ms +7.43% -3.22% 2.89%
inserterOpen 39.64 ms +9.54% -6.18% 39.97 ms +5.85% -10.61% -0.83%
inserterHover 11.43 ms +9.54% -8.22% 11.79 ms +5.77% -4.58% -3.05%
inserterSearch 8.87 ms +3.49% -3.72% 8.89 ms +4.16% -2.92% -0.22%
loadPatterns 673.56 ms +4.65% -4.68% 677.63 ms +5.02% -4.31% -0.6%
wpTotal 368.64 ms +9.99% -1.31% 385.75 ms +4.35% -4.08% -4.44%
wpMemoryUsage 14.80 MB +0% -0% 14.76 MB +0% -0% 0.25%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric fe099a5 trunk % Change
serverResponse 331.36 ms +2.27% -9.52% 326.13 ms +0.92% -11.33% 1.6%
firstPaint 345.06 ms +11.53% -13.35% 314.29 ms +24.79% -8.58% 9.79%
domContentLoaded 687.37 ms +1.62% -1.35% 694.51 ms +2.74% -3.03% -1.03%
loaded 688.67 ms +1.64% -1.34% 695.84 ms +2.74% -3.04% -1.03%
firstContentfulPaint 385.35 ms +1.83% -1.19% 385.18 ms +3.93% -1.55% 0.04%
firstBlock 2125.89 ms +0.93% -1.73% 2119.5 ms +1.08% -1.25% 0.3%
type 15.63 ms +6.97% -6.21% 14.56 ms +8.86% -8.24% 7.35%
navigate 98.84 ms +3.6% -1.74% 93.11 ms +13.25% -8.71% 6.15%
loadPatterns 1249.25 ms +3.28% -8.6% 1212.41 ms +5.93% -11.09% 3.04%
loadPages 1030.82 ms +1.02% -1.69% 966.27 ms +1.63% -3.4% 6.68%
wpTotal 322.9 ms +2.35% -9.79% 317.62 ms +0.85% -11.62% 1.66%
wpMemoryUsage 12.84 MB +0% -0% 12.80 MB +0% -0% 0.28%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

14e896e 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.

As a user I want to be able to create a navigation overlay for a specific navigation block in /test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('region', { name: /(Editor publish|Save panel)/ }).getByRole('button', { name: 'Save', exact: true })

    at Editor.saveSiteEditorEntities (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/site-editor.ts:48:5)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-overlay-template-part.spec.js:91:4
page-list submenu user interactions in /test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js, passed after 1 failed attempt.
TimeoutError: locator.click: Timeout 10000ms exceeded.
Call log:
  - waiting for getByRole('region', { name: 'Editor top bar' }).getByRole('button', { name: 'Save', exact: true })
    - locator resolved to <button type="button" aria-disabled="true" class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact">Save</button>
  - attempting click action
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
    - waiting 20ms
    2 × waiting for element to be visible, enabled and stable
      - element is not enabled
    - retrying click action
      - waiting 100ms
    16 × waiting for element to be visible, enabled and stable
       - element is not enabled
     - retrying click action
       - waiting 500ms

    at Editor.saveSiteEditorEntities (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/editor/site-editor.ts:39:22)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-frontend-interactivity.spec.js:706:4

14e896e Run

@jasmussen

Copy link
Copy Markdown
Contributor

Thanks for all these PRs. Same feedback as on the Audio block applies here, and due to the recent discussions around the feature overall, perhaps we can briefly pause them until we have a decision, which I hope will land soon.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Thanks for all these PRs. Same feedback as on the Audio block applies here, and due to the recent discussions around the feature overall, perhaps we can briefly pause them until we have a decision, which I hope will land soon.

Agreed! I’ll hold off on creating any new PRs for now. I’ve already created three PRs for the File, Video, and Audio Blocks. I think it would be better to wait until a decision is made before continuing development.

@fcoveram

fcoveram commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

I shared an idea in #66563 about how the control handles different media types.

@t-hamano

Copy link
Copy Markdown
Contributor

The thumbnail is blank for a video, since the preview shows the selected file itself.

@im3dabasia I think the blank thumbnail has already been addressed on trunk, since MediaControl now falls back to an icon for non-image media. Could you rebase this PR and pass mediaType="video" to MediaControl, so that we can see the correct preview?

@im3dabasia
im3dabasia force-pushed the add/video-block-media-panel branch from 55148e0 to 79068ed Compare November 30, 2026 09:26
@im3dabasia

Copy link
Copy Markdown
Contributor Author

@t-hamano Rebased on trunk, and the video now shows its icon. Could you take another look?

Here's a short video reference of what it looks like today:

Screen.Recording.2026-11-30.at.3.16.24.PM.mov

@t-hamano

t-hamano commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

@im3dabasia, can you resolve the merge conflicts? edit.jsx has been converted to TypeScript in trunk.

im3dabasia and others added 2 commits December 3, 2026 15:43
@im3dabasia

im3dabasia commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, @t-hamano 🙌, and thanks to everyone involved in this PR. I'm going to merge this!

@im3dabasia
im3dabasia enabled auto-merge (squash) December 3, 2026 10:17
@im3dabasia
im3dabasia merged commit e6c5e3f into trunk Dec 3, 2026
81 checks passed
@im3dabasia
im3dabasia deleted the add/video-block-media-panel branch December 3, 2026 10:35
@github-actions github-actions Bot added this to the Gutenberg 24.7 milestone Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Video Affects the Video Block [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