Skip to content

File: Add flex layout and block gap supports - #82851

Open
im3dabasia wants to merge 25 commits into
trunkfrom
add/file-block-flex-layout
Open

im3dabasia wants to merge 25 commits into
trunkfrom
add/file-block-flex-layout

Conversation

@im3dabasia

@im3dabasia im3dabasia commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What?

See #19951

Adds layout and block gap supports to the File block, so its content can be justified and its spacing themed.

Why?

How?

  • Adds flex layout support with justification only.
  • Adds block gap support, replacing the old hardcoded margins.
  • Keeps existing spacing by default, following this suggestion.
  • Keeps centered and right-aligned File blocks in place, including classic themes and RTL.
  • Shows an empty file name only while the block is selected, like captions.

Testing Instructions

  1. Add a File block, upload a file, and pick "Space between" in the toolbar.
  2. Check the Download button moves right, in the editor and on the front end.
  3. Set row and column values under Block spacing, and check both apply.
  4. Compare existing File blocks with trunk in a block and a classic theme, including centered, right-aligned and RTL.

Testing Instructions for Keyboard

  1. Focus the File block and press Alt+F10 to reach the toolbar.
  2. Open the justification control with Enter and pick an option with the arrow keys.

Trade-offs

  • A theme's site-wide block gap doesn't reach the File block, the same as on trunk.
  • Three zero specificity rules map alignment to justification, so existing blocks don't shift (why)

Screenshots or screencast

file-block-shows-rich-text-field-on-selection.mov

Use of AI Tools

Claude Code

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Sep 14, 2026
@im3dabasia im3dabasia changed the title feat: Add flex layout support to the File block File: Add flex layout support for justifying the download button Sep 14, 2026
@im3dabasia im3dabasia self-assigned this Sep 14, 2026
@im3dabasia im3dabasia added [Block] File Affects the File Block [Type] Enhancement A suggestion for improvement. labels Sep 14, 2026
@im3dabasia
im3dabasia added this pull request to stack #82853 September 14, 2026 14:45
@github-actions

github-actions Bot commented Sep 14, 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: jasmussen <joen@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@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: -513 B (-0.01%)

Total Size: 8.58 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 415 kB +79 B (+0.02%)
build/styles/block-library/editor-rtl.css 12.9 kB -47 B (-0.36%)
build/styles/block-library/editor-rtl.min.css 10.5 kB -54 B (-0.51%)
build/styles/block-library/editor.css 12.9 kB -48 B (-0.37%)
build/styles/block-library/editor.min.css 10.5 kB -54 B (-0.51%)
build/styles/block-library/file/editor-rtl.css 229 B -123 B (-34.94%) 🎉
build/styles/block-library/file/editor-rtl.min.css 207 B -117 B (-36.11%) 🎉
build/styles/block-library/file/editor.css 232 B -121 B (-34.28%) 🎉
build/styles/block-library/file/editor.min.css 207 B -117 B (-36.11%) 🎉
build/styles/block-library/file/style-rtl.css 337 B +12 B (+3.69%)
build/styles/block-library/file/style-rtl.min.css 296 B +14 B (+4.96%) 🔍
build/styles/block-library/file/style.css 349 B +12 B (+3.56%)
build/styles/block-library/file/style.min.css 296 B +13 B (+4.59%) 🔍
build/styles/block-library/style-rtl.css 22.9 kB +10 B (+0.04%)
build/styles/block-library/style-rtl.min.css 19.4 kB +9 B (+0.05%)
build/styles/block-library/style.css 23 kB +11 B (+0.05%)
build/styles/block-library/style.min.css 19.4 kB +8 B (+0.04%)

3f3d25e Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 33d508b trunk % Change
timeToFirstByte 55.8 ms +15.5% -2.24% 59.1 ms +13.37% -9.22% -5.58%
largestContentfulPaint 100 ms +10% -10% 100 ms +6% -10% 0%
lcpMinusTtfb 37.85 ms +17.57% -10.3% 35.45 ms +23.41% -3.81% 6.77%
wpBeforeTemplate 28.79 ms +19.1% -2.12% 29.26 ms +22.49% -4.34% -1.61%
wpTemplate 22.83 ms +10.03% -3.46% 24.08 ms +6.1% -10.67% -5.19%
wpTotal 51.28 ms +15.87% -1.38% 54.8 ms +12.99% -9.85% -6.42%
wpMemoryUsage 7.71 MB +0% -0% 7.67 MB +0% -0% 0.54%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric 33d508b trunk % Change
timeToFirstByte 45.8 ms +6.99% -1.2% 40.7 ms +5.9% -2.7% 12.53%
largestContentfulPaint 100 ms +6% -0% 88 ms +4.55% -0% 13.64%
lcpMinusTtfb 55.65 ms +1.89% -2.52% 48.35 ms +2.9% -1.86% 15.1%
wpBeforeTemplate 24.6 ms +3.54% -0.81% 24.47 ms +3.68% -1.84% 0.53%
wpTemplate 17.73 ms +2.48% -2.82% 12.75 ms +5.88% -2.9% 39.06%
wpTotal 42.36 ms +7.32% -0.85% 37.35 ms +6.61% -2.44% 13.41%
wpMemoryUsage 6.40 MB +0% -0% 6.25 MB +0% -0% 2.39%
wpDbQueries 13 +0% -0% 9 +0% -0% 44.44%

media-processing

Metric 33d508b trunk % Change
mediaProcessingJpeg 425.37 ms +0.63% -0.67% 424.95 ms +1.51% -1.51% 0.1%
mediaProcessingAvif 6246.18 ms +0.29% -0.2% 6259.97 ms +0.53% -0.37% -0.22%
mediaProcessingJpegToAvif 4365.75 ms +0.21% -0.09% 4392.63 ms +0.44% -0.17% -0.61%

media-upload

Metric 33d508b trunk % Change
jpegUploadProcessing 1965.61 ms +1.48% -1.04% 1726.86 ms +14.07% -15.91% 13.83%
pngUploadProcessing 248.62 ms +5.62% -29.24% 222.42 ms +17.26% -22.41% 11.78%
largeJpegUploadProcessing 1958.61 ms +1.25% -0.59% 1948.87 ms +0.43% -0.79% 0.5%
multipleImageUploadProcessing 2061.64 ms +0.67% -0.46% 2039.81 ms +1.19% -0.87% 1.07%

post-editor

Metric 33d508b trunk % Change
serverResponse 488.35 ms +0.83% -8.14% 487.32 ms +0.73% -8.19% 0.21%
firstPaint 368.92 ms +36.93% -10.82% 343.58 ms +7.63% -25.55% 7.38%
domContentLoaded 887.13 ms +2.09% -0.89% 873.9 ms +0.81% -0.53% 1.51%
loaded 888.11 ms +2.11% -0.87% 874.88 ms +0.83% -0.5% 1.51%
firstContentfulPaint 517.3 ms +1.83% -0.86% 509.01 ms +4.07% -0.91% 1.63%
firstBlock 2290.72 ms +0.96% -1.32% 2247.37 ms +0.43% -1.58% 1.93%
type 20.1 ms +10.4% -3.73% 19.31 ms +4.92% -6.63% 4.09%
typeWithoutInspector 19.9 ms +3.77% -3.57% 19.3 ms +12.18% -7.31% 3.11%
typeWithTopToolbar 26.4 ms +4.77% -2.95% 25.07 ms +8.06% -8.38% 5.31%
typeContainer 9.13 ms +9.09% -3.4% 8.61 ms +19.51% -5.92% 6.04%
focus 126.07 ms +6.6% -3.36% 113.52 ms +9.58% -3.75% 11.06%
firstFocus 295.53 ms +0% -0% 257.81 ms +0% -0% 14.63%
selectAll 433.21 ms +2.06% -1.3% 402.9 ms +3.17% -2.78% 7.52%
undo 33.63 ms +3.93% -5.89% 31.35 ms +6.25% -2.97% 7.27%
listViewOpen 83.98 ms +10.45% -10.62% 83.73 ms +7.02% -14.68% 0.3%
inserterOpen 43.15 ms +17.59% -6.56% 39.91 ms +15.51% -6.97% 8.12%
inserterHover 12.9 ms +12.71% -11.09% 10.5 ms +10.57% -8.38% 22.86%
inserterSearch 8.55 ms +11.11% -5.26% 8.17 ms +8.08% -8.94% 4.65%
loadPatterns 706.17 ms +2.75% -7.26% 619.18 ms +5.94% -3.06% 14.05%
wpTotal 478.77 ms +0.81% -8.32% 477.66 ms +0.69% -8.41% 0.23%
wpMemoryUsage 14.76 MB +0% -0% 14.72 MB +0% -0% 0.27%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric 33d508b trunk % Change
serverResponse 467.43 ms +0.85% -8.62% 453.42 ms +4.54% -5.9% 3.09%
firstPaint 361 ms +8.08% -14.86% 361.87 ms +5.52% -5.65% -0.24%
domContentLoaded 849.16 ms +3.82% -1.65% 852.03 ms +2.74% -1% -0.34%
loaded 849.96 ms +3.84% -1.61% 852.84 ms +2.77% -1.01% -0.34%
firstContentfulPaint 496.1 ms +5.48% -2.66% 488.89 ms +2.86% -0.84% 1.47%
firstBlock 2514.38 ms +3.73% -1.56% 2491.61 ms +0.58% -0.78% 0.91%
type 17.59 ms +3.41% -2.79% 17.17 ms +7.16% -7.92% 2.45%
navigate 109.53 ms +5.1% -1.73% 107.66 ms +3.16% -2.02% 1.74%
loadPatterns 1061.52 ms +5.44% -6.89% 1076.08 ms +5.83% -4.97% -1.35%
loadPages 976.69 ms +3.55% -2.56% 989.15 ms +0.88% -4.37% -1.26%
wpTotal 458.05 ms +0.88% -8.8% 443.73 ms +4.66% -5.98% 3.23%
wpMemoryUsage 12.78 MB +0% -0% 12.73 MB +0% -0% 0.34%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

3f3d25e 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 insert content using the global inserter 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).toBeFocused() failed

Locator: getByRole('combobox', { name: 'Search or type URL' })
Expected: focused
Timeout: 5000ms
Error: element(s) not found

Call log:
  - Expect "toBeFocused" getByRole('combobox', { name: 'Search or type URL' }) with timeout 5000ms
  - waiting for getByRole('combobox', { name: 'Search or type URL' })

    at LinkControl.useLinkControlSearch (/home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:416:47)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/navigation-sidebar-list-view.spec.js:179:21
should give the image its context menu while selected @WebKit @Firefox in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: apiRequestContext.fetch: socket hang up
Call log:
  - → POST http://localhost:8891/wp-json/wp/v2/media
    - user-agent: Playwright/1.63.0 (x64; ubuntu 24.04) node/24.20 CI/1
    - accept: */*
    - accept-encoding: gzip,deflate,br
    - X-WP-Nonce: ac04cbbf1f
    - content-type: multipart/form-data; boundary=----WebKitFormBoundary1ZAR5m4iahGNDiek
    - content-length: 4087471
    - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_da433b7faafd8180ebeb1624ceeeab7e=admin%7C1793794449%7CoZGymDGZ8kGxr3vKzQ3gPWQ7YmPkjAtYijgk1tXhqHJ%7C6e75714509d4a26eee927f4dd0138f373370434abc0ccede41818c0e08ee7216; wp-settings-time-1=1793621650

    at RequestUtils.rest (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/rest.ts:111:39)
    at RequestUtils.uploadMedia (/home/runner/work/gutenberg/gutenberg/packages/e2e-test-utils-playwright/src/request-utils/media.ts:51:30)
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:1047:36
should undo without broken temporary state in /test/e2e/specs/editor/blocks/image.spec.js, passed after 1 failed attempt.
Error: expect(received).toBe(expected) // Object.is equality

- Expected  - 2
+ Received  + 2

- <!-- wp:image -->
- <figure class="wp-block-image"><img alt=""/></figure>
+ <!-- wp:image {"id":21,"sizeSlug":"full","linkDestination":"none"} -->
+ <figure class="wp-block-image size-full"><img src="http://localhost:8889/wp-content/uploads/2026/11/a657a6bc-62ba-4a2f-81b0-b02a47814548.png" alt="" class="wp-image-21"/></figure>
  <!-- /wp:image -->
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/image.spec.js:432:49

3f3d25e Run

@im3dabasia
im3dabasia force-pushed the add/file-block-flex-layout branch from 9f7624e to e71084d Compare September 15, 2026 06:16
@im3dabasia
im3dabasia marked this pull request as ready for review September 15, 2026 07:10
@im3dabasia
im3dabasia requested a review from mirka September 15, 2026 07:11

@jasmussen jasmussen 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.

Thank you, this is fantastic! The video is very compelling, and the File block will be substantially more useful because of this.

I left some questions on the code. The primary question is: do we need any CSS at all for this to land? What would happen if we didn't add any?

@ciampo ciampo 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'm not necessarily the best reviewer on block development, left a few comments nonetheless

@im3dabasia
im3dabasia force-pushed the add/file-block-flex-layout branch from 3a85ebf to ea98300 Compare September 15, 2026 14:22
@im3dabasia

im3dabasia commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @/ramonjd for spotting the editor margins, and @/jasmussen for the block gap input, between them, that's what sent me down this path.

Trunk spaced this block with two margins, one on the button and one under the preview, and the flex layout cancels both. I first tried replacing them with a gap of my own, but that turned out to be the wrong place for it, so spacing is now handled by block gap support instead.

The measurements that were in this comment described that earlier attempt, so they no longer apply.

@im3dabasia

im3dabasia commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

What I tried first was adding the gap directly in the block's CSS. That wasn't a good approach — because of specificity, the theme's styles and anything set on the block couldn't override ours.

Wrapping it in :where(), the way the rest of the block's CSS does today, just flips it the other way: the theme's spacing loads later and wins, so we lose the current spacing regardless.

@im3dabasia

im3dabasia commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Went ahead with block spacing support here rather than in a follow-up, and removed the gap rule entirely, the block now ships no spacing CSS at all.

Checked on the front end that both the row and column values apply independently, and that a theme setting File block spacing wins over anything the block would do on its own.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Hi @tellthemachines @ramonjd, just gently bringing this one back up.

From the discussion above, the layout support itself seems like a useful addition, so the remaining question is how the spacing default should behave.

I've laid out three options above with the trade-offs I found, and I'd really value your thoughts on which direction fits best, or whether there's an angle I've missed.

@ramonjd ramonjd added the Needs Dev Note Requires a developer note for a major WordPress release cycle label Oct 9, 2026
@ramonjd

ramonjd commented Oct 9, 2026

Copy link
Copy Markdown
Member

Thanks for your patience on this one, @im3dabasia, and for laying the options out so clearly. Lots going on.

I'm not sure, but the way you've explained it, option 1 seems to be the best of the bunch given there are precedents.

__experimentalDefault only applies when a theme doesn't set settings.spacing.blockGap (here). Looks like columns works the same way with its 2em default?

In relation to the concern above about preserving back compat in block themes, I assume they'll get the theme's gap instead, or 24px from core's theme.json if the theme sets none?

That sounds like a reasonable trade off on the surface. A theme can opt into block gap like this, right?

"styles": {
	"blocks": {
		"core/file": {
			"spacing": {
				"blockGap": "0.22em"
			}
		}
	}
}

I'll add a Needs Dev Note label here so we don't forget to explain things if anything changes.

One related question: is a split row/column default something block gap should support?

I don't know, but my instinct is to leave it out for now to reduce complexity and the test surface for reviewers. It could be a follow up if required. Better to iterate on these things in my opinion.

Weirdly, I'm not seeing it output when testing this PR with a classic theme either.

@tellthemachines I tried to reproduce this, and I think it might be related to caching rather than this PR.

If I delete the wp_styles_for_blocks transient via wp transient delete wp_styles_for_blocks, I see it (2015 theme)

Screenshot 2026-10-09 at 6 37 17 pm

Maybe it's because when switching to this branch the block's __experimentalDefault isn't part of the cache?

Could be wrong, and maybe it's about a specific classic theme...

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Thanks for your patience on this one, @im3dabasia, and for laying the options out so clearly.

Thanks @ramonjd, that's really helpful, and no worries at all about the wait.

Happy to go with option 1 then. And yes, Columns does the same thing, which is reassuring.

So the order ends up, weakest to strongest:

  1. The block's own default, which only applies in classic themes.
  2. The theme's site-wide block gap, which is what block themes fall back to.
  3. A theme's core/file value, if it sets one.
  4. Whatever is set in Block spacing on the block itself.

NB: what this costs

  • Classic themes: a single 0.75em default covers both directions, so the vertical is slightly tighter than trunk.
  • Block themes: nothing comes from the block, so existing blocks take the theme's site-wide gap instead of their old spacing.

Why not give block themes a default too?

Defaults don't apply there. We could add it as a block style instead, and existing blocks would then keep their spacing everywhere. A theme's core/file value would still reach the block, as would Block spacing set on the block itself, but a theme's site-wide gap wouldn't, and that's the cost.


On your questions, both match what I measured:

  • Block themes get the theme's gap, or core's 24px when none is set.
  • A theme can opt in as you wrote it; I tested it.

It could be a follow up if required. Better to iterate on these things in my opinion.

Agreed, happy to revisit it separately if it comes up.

Maybe it's because when switching to this branch the block's __experimentalDefault isn't part of the cache?

That would explain it. It shows up fine for me on classic themes.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Hi @ramonjd @tellthemachines, thanks for the reviews so far!

The branch is up to date with trunk, and the "Space between" case without a file name is now handled. I've added a short status at the top of the description too.

@tellthemachines, does the option 1 trade-off for block themes work for you? @ramonjd, is there anything else you'd like to see before this is ready?

@aaronrobertshaw aaronrobertshaw 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.

Thanks for working through all the layout cases here @im3dabasia 👍

I've taken this for a quick spin and it seems the saved blocks remain valid and their alignment holds. My concern is around the spacing on existing content.

As discussed, with this PR, the gap in File blocks falls back to the theme's root block gap. That changes the spacing of every File block already on a site, in every theme. I don't think a layout support change should come with a visual change to existing content.

We can keep the layout support and trunk's spacing:

  1. Drop the __experimentalDefault. It adds a null placeholder that wipes any core value.
  2. Set the block's default gap for core/file in core's theme.json, like Icon in #75653.
  3. Add the same gap to style.scss as div:where(.wp-block-file) { gap: 1.3em 0.75em; }. Classic themes only get a zero specificity fallback gap, so this wins there and loses to any Global Styles gap.

Theme and user gaps still win, and existing content keeps its spacing.

@im3dabasia

im3dabasia commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @aaronrobertshaw. Agreed that adding a layout support shouldn't change how existing File blocks look, so I've applied your suggestion.

Where it lands:

  • Existing File blocks stay close to their current spacing, in both block and classic themes.
  • Horizontal spacing uses the same value as trunk. Vertical spacing is close, but can vary slightly between themes.

Trade-off

  • A theme's site-wide block gap won't reach the File block. It doesn't today either, since the block has no block gap support on trunk, so this seems acceptable.

In summary, for developers and users

  • Block themes, highest priority first:
    1. Block level gap
    2. Theme level core/file
    3. Core theme.json core/file (1.3em / 0.75em)
  • Classic themes: File block stylesheet div:where(.wp-block-file) keeps spacing close to trunk.

cc @ramonjd, since this replaces the direction we discussed earlier.

PS:

  • The failing unit test is because the theme.json schema doesn't allow separate row and column gaps yet; #86044 fixes that.
  • The performance test failure comes from trunk's comparison run, not this PR.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Folks this was merged #86044 (thanks to Aaron for the quick review), now tests pass in this PR. This is ready for review.

Open to reviews and feedbacks! TIA

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Hi team,

After incorporating @aaronrobertshaw's feedback, this PR now handles backward compatibility much better, and I think the new block gap support is in a good place.

Thanks for the reviews so far! Happy to address any remaining feedback.

@t-hamano

Copy link
Copy Markdown
Contributor

Rather than only deciding whether to merge this PR, I think it might be better to step back and discuss the overall direction first.

My understanding is that one of the reasons this PR was submitted is the proposal in #19951 (comment): grouping File blocks together, and laying out the file name and the Download button with "space between".

639335213-5cb94c04-4d4b-4152-9c90-bbdf10e3124a

In other words, this PR assumes that a new wrapper block for File blocks will be added. It's true that the File block lacks customizability, but as I mentioned here, I'm not very positive about introducing a wrapper block. I'm also hesitant about converting the File block to use inner blocks (see #57314 (comment)).

If we decide not to introduce a wrapper block, I'm not confident that shipping this PR on its own would be worth it, when weighing the benefits against the cost of maintaining backward compatibility.

I'd love to hear everyone's thoughts.

@im3dabasia

Copy link
Copy Markdown
Contributor Author

Thanks, that's fair, and stepping back on the direction makes sense. You're right that the wrapper block was the main motivation for this PR.

That said, I think it still helps a single File block on its own:

  • Users can justify its contents, including "space between", which isn't possible today.
  • Spacing becomes something themes and users can change, instead of hardcoded margins.

Since existing File blocks keep their spacing and alignment, the ongoing cost is a few small compatibility styles. If the consensus is that this isn't worth it without the wrapper, I'm happy to close it. Keen to hear what others think.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] File Affects the File Block Needs Dev Note Requires a developer note for a major WordPress release cycle [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.

9 participants