Repository navigation
Background Image block support follow-up tasks #54336
Copy link
Copy link
Open
Labels
[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experiTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Type] EnhancementA suggestion for improvement.A suggestion for improvement.[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Description
Related to #16479, following on from #14744.
Now that the background image block support has been introduced in #53934, this issue captures some ideas for follow-up tasks and features.
Prioritized tasks for WP 6.8 and beyond
- Setting background-image overrides background gradient #60401 - WIP WIP Experiment: combine gradient and background image into
background-image#60739- Gradient backgrounds should be set with
background-imageinstead ofbackground#32787 - Get the block support to work with gradient backgrounds in a logical way. See related comment: Global styles: add background image to top-level theme.json styles #59354 (comment) - Update Core safecss_filter_attr/kses to support linear gradient/rgb(a). See: WIP Experiment: combine gradient and background image into
background-image#60739 (comment)
- Gradient backgrounds should be set with
- Background image: should it integrate with background-image theme mod? #60939
- Allow for background-attachment and other controls to be disabled via theme.json (?)
- Improve organisation of site background options #63096
- Global Styles: Improve organisation of site background color and image #63216
- Background image: remove toolspanel placeholder component #64242
- Global Styles: refactor site background controls and move site global styles into Background group #65304
- Global Styles: Adds site background color controls component in global styles #66736
- Background image: add support for relative theme path URLs in template and pattern files #62254
- Add support for relative theme paths in variation styles and variation block styles. See: https://github.com/WordPress/gutenberg/pull/60100/files#r1639128861
- Fix default controls support for background support and panel Background supports: add default controls supports #68085
- Add ability to skip background support serialization in line with other block supports
Prioritized tasks for WP 6.7
- Background image: add uploading state and restrict drag to one image. #64565
- Background images: add support for theme.json ref value resolution #64128
- Background image: ensure consistency with defaults and fix reset/remove functionality #64328
- Background images: ensure appropriate default values #64192
- Global styles: consolidate theme.json ref and URI resolution #64182
- Background image: move controls into a popover #60151
- Background: add background attachment to top level styles #61382 - adds support for background-attachment
- Global styles: block background UI controls #60100
- Hook up post editor to inherited global styles and allow setting to "None". See: Global styles: block background UI controls #60100 (comment)
- Quote blocks: add background image and minimum height support #62497
- Verse block: add background image and minimum height support #62498
- Post content block: add background image and padding support #62499
- Background Image: Make panel appear in a consistent location #63551
Completed for WP 6.6
- Background images: add defaults for background size #62046
- Global styles: add option to remove site-wide theme background image #61998
- Background image tool: Improvements, bugfixes, find alternative to "fixed" #61928
- Add support for theme relative url paths for site-wide background images
- Ensure that the site editor and frontend body
min-heightvalues match when a background is selected. Global styles: force root min-height of 100% for backgrounds #59809 - Move background default values logic to block supports Background block supports: move block support defaults to gutenberg_render_background_support and revert gutenberg_get_background_support_styles #59889 and Background block supports: move size defaults to hooks and block.json #60008
- Global styles: background UI controls #59454
- Global styles: add background to global styles changes output #60229
- Global styles: background UI control labels #60264
- Background image: use media upload flow #60687
- Background image: tools panel shouldn't show reset button for inherited values #61304
- Background images: remove required "file" prop #61387
- Background image: size controls should show when an image is set #61388
- Background image: explicitly set background repeat value in user styles #61526
- Global styles: Group "Background image" in "Layout" section #61494
Completed for WP 6.5
- Add
contain, fixed size and repeat controls: Background image: Add backgroundSize and repeat features #57005 - Background image support: add background position controls #58592
- Group block: When background image is set,
has-backgroundCSS class is missing #56261 - Background image: Add has-background classname when background image is applied #57495
- Background image block support: Add tests for size and repeat output #57474
- Background Image block support: Add reset menu item #54341
- Improve background image control #54439
- Background Image control: use consistent button, ensure descriptive text accounts for no image selected #54711
- Background image: Add backgroundSize and repeat features #57005
Unprioritized tasks
- Enable editor background tools image preview for theme.json
url(...)string values. See Background images: add support for theme.json ref value resolution #64128 (comment) - Redesign background controls, taking into account background fills/gradients
- Design proposal: Global styles: block background UI controls #60100 (comment)
- Site Export: ensure that the export endpoint uses Gutenberg theme classes #61561
- Add repeat-x and repeat-y options to background images #62608
- Propose adding
stylesheet_uriandtemplate_urifield to themes endpoint (Trac ticket, Core PR) - Theme.json: create a consistent syntax for relative paths #61804
- User global styles: should we save relative paths to the database for uploaded assets? #61809
- Improve performance by allowing support for optimized image size output Background image block support: optimize image output #59113
- Add support for background images via URL rather than just via media library
- Add option to use Featured Image
- Explore potentially allowing aspect ratio support, as requested for the Cover block: Add aspect ratio selector to Cover Block #54032
- Explore an option for opacity or overlay of the background image - background image: add overlay or filter option #66019
- Background image block support: optimize image output #59113
- Background Image Block Support - Add ability to define which orientation the sizing should adhere to #62219
Background position improvements
- Allow non-percent-based units (e.g. rem, em, etc)
- Allow values that are relative to a particular side (see 3-value and 4-value syntax on MDN) to allow for example "4em from top"
- Consolidate controls with those in the Cover block
- Look into preventing the controls from displaying until a background image is set (e.g. by moving the size, etc controls into a popover)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Feature] Design ToolsTools that impact the appearance of blocks both to expand the number of tools and improve the experiTools that impact the appearance of blocks both to expand the number of tools and improve the experi[Type] EnhancementA suggestion for improvement.A suggestion for improvement.[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Type
Projects
- StatusShow more project fields🦵 Punted to 7.0
Activity
Ren2049 commentedon Sep 12, 2023
Image embeds are vital for prototyping within the block editor (before comitting them to the media library).
annezazu commentedon Sep 27, 2023
Pulling from the FSE Outreach Program's Final Touches call for testing, I wondered if the focal point option would eventually be added in as well:
& more here:
& more here:
Happy to open a separate issue if that's easier!
andrewserong commentedon Sep 27, 2023
Oh, yes! It'd be good to have that as an option, too. I've added it to the list in this tracking issue — no need to create a separate issue for it just yet, I think this is a good place to gather together the ideas for now.
Color overlay is possibly a little out of scope for the Group block, as it's well handled by the Cover block and would require additional markup to achieve. The main differences between what we can do for the Group vs Cover blocks at the moment is whether the additional styling rules can be applied to a simple outer wrapper (Group block) vs requiring an additional inner wrapper (Cover block).
eduardozulian commentedon Oct 13, 2023
I'm +1 a few of the recommendations here. Here's the list I gathered based on stuff we offer for the Cover Block, all of them already shared:
@andrewserong I believe you're also aware of Automattic/wp-calypso#82284 but I wanted to move it here just to confirm if the lack of padding on the group block is currently expected or if we should indeed offer a default padding if there is a background image/color.
Thank you!
andrewserong commentedon Oct 15, 2023
Thanks for adding that feedback here @eduardozulian!
Lack of padding on the Group block is expected. The Cover block is a more opinionated block when it comes to adding a background image, and so padding is formally a part of that block's background image implementation. The Group blocks are more general purpose blocks so it's up to the user (or pattern) to add padding when required. There are currently no plans to add padding by default when a user selects a background image.
webzunft commentedon Oct 26, 2023
I see that the generated inline style escapes the quotation marks within
url(). E.g.,style="background-image:url('https://example.com/wp-content/uploads/2023/10/img-scaled.jpg');background-size:cover;"I don’t see this being a standard in core. If it isn’t, could this be changed to using unescaped quotes?
andrewserong commentedon Oct 26, 2023
@webzunft I believe the escaping occurs due to how the attribute is output in server rendering as the HTML Tag Processor internally calls
esc_attrwhen updating an HTML attribute. Is the presence of escaped quotes causing any visual issues on the site frontend for you? The inline styles are only injected at render time, and aren't saved in post content, so it should be possible to make tweaks to how the styles are output in the future.webzunft commentedon Oct 27, 2023
@andrewserong thanks for your reply. The browser (Chrome) correctly renders the output, so no problem there. I have a plugin that changes HTML in the frontend to inject some information (image captions), which broke with these escaped quotes, but nothing I can’t adjust on my end.
joemcgill commentedon Nov 27, 2023
I'm currently looking at image optimizations for various blocks in the editor, and wanted to raise the issue here of needing to allow the browser to optimize loading the most appropriate image for the user. For blocks that render images as
imgelements, WordPress will automatically addsrcsetandsizesattributes, and possible addloading="lazy"orfetchpriority="high"to optimize resource loading. Coming up with a way of applying resource optimizations to background images would be an important performance improvement.Related:
mikemcalister commentedon Dec 21, 2023
Not sure if you meant opacity here as well. I'm genuinely curious what the use case is for the group block with a background image but no way to control the overlay?
Groups have content, usually text,and most background images will make text illegible without some way of reducing the brightness. I've created hundreds of patterns, and I can't think of a single use case where I didn't use opacity when using a background image on the cover block.
Unfortunately, background images and the ability to control opacity and background color are inextricably tied together. If we're adding it to groups, for consistency and usability, it has to come with these controls to make it practically usable. It will be an ongoing battle with users for sure!
andrewserong commentedon Dec 21, 2023
Great question. In my experience there are heaps!
A good example of use cases for background images that don't require overlay colors are ones that already include transparency within them, or images that folks have selected for their particular content (i.e. I know I'm going to write something with white text, so I'll pick a nice subdued dark image as my background). For examples of some good transparent background images, I've been playing with those at https://www.transparenttextures.com/ and https://www.toptal.com/designers/subtlepatterns/. Many of those sorts of background images require being able to set the image to repeat, which is being worked on over in #57005.
In terms of the user being able to adjust the opacity or overlay of the background image itself from within the editor, I think that's a great idea, it's just not a very simple task to implement within block supports or to enable for the Group block, so for now I think the other block support features are more pressing to implement, as the Cover block can already handle the overlay case.
I'm just one contributor chipping away at this, but in my opinion, I'd go for us building out the remaining features of the background image support that don't require altering markup (as overlay would require injecting an additional element), and to revisit the idea a little further down the track. It would be nice to support opacity/overlay for it eventually, for sure. I've added it as an item to the issue's description 👍
23 remaining items
t-hamano commentedon Sep 29, 2025
This ticket was featured on today's 6.9 Bug Scrub.
I'd be grateful if you could let me know if there are any tasks that need to be prioritized for the 6.9 release. Thank you!
ramonjd commentedon Sep 30, 2025
Thanks @t-hamano
The most important in my opinion are the following:
background-imageinstead ofbackground#32787They are related.
However I don't think folks will have time to work on a solution for this before 6.9 beta unfortunately.
t-hamano commentedon Sep 30, 2025
@ramonjd Thanks for the reply.
Let's punt this issue to 7.0 if anyone doesn't pick up tasks.
t-hamano commentedon Oct 13, 2025
This issue was featured on today's 6.9 Bug Scrub. There is no activity on this issue, so let's punt it to 7.0.
jasmussen commentedon Aug 26, 2026
I took the liberty of checking a few boxes that appeared to have been addressed. But also, to remove the “needs design" label: firstly this is already on a solid path and I believe it is unblocked on design, especially since the recent reorganisation into Typography and Background panels. But please correct me if I'm wrong, and aspects do need design. I'd appreciate pings on individual PRs, or if there's something larger, we can discuss here.
ramonjd commentedon Aug 26, 2026
Thanks @jasmussen
I also did a small clean up.
I don't know if we'll have the bandwidth to take much of this on this cycle, but here's an assessment of what we could keep open based on the issue description:
Not implemented / could be easy
and other controls to be disabled via theme.json (?)" item. Half-built already?
url(...)string background image values.background.__experimentalSkipSerializationin edit mode (PHP already honours it).Open PRs
The hard stuff / not planned
background-imagetheme mod integration — unresolved product decision sinceJul 2024
path syntax)
jasmussen commentedon Aug 26, 2026
Nice, thank you for the update. I don't know that any one of those is supremely more urgent than everything else, so my triage was just that. For now I've subscribed to the hard stuff you've mentioned, and will see if I can chime in!