Roster of design tools per block (WordPress 6.6 edition)

Below you find a table that lists all coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. blocks available in the inserter marks in the grid the feature they support in the blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor. Itโ€™s a basic lookup table that helps developers to find the information quickly.

While this post is released as part of 6.6, the content summarizes changes between 6.1 and 6.6. This is an update of the post published for the 6.1 release and provides a cumulative list of design supports added with the last five WordPress releases.

The features covered are:

  • Align
  • Typography,
  • Color,
  • Dimension,
  • Border,
  • Layout,
  • Gradient,
  • Duotone,
  • Shadow,
  • Background image*
  • Pattern overrides / Block Bindings (PO/BB)

*Note: In WordPress 6.6, the background image tools are only available for Group, Pull quote, Site Logo blocks and as side-wide feature. For Quote, Verse and Post content blocks, itโ€™s only in GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses โ€˜blocksโ€™ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. 18.6 and slated for WordPress 6.7.

Updated on July 3 with the list tracking issues to add various design tools to core blocks, so one can follow along the progress.

Work in progress

The issue Tracking: Addressing Design Tooling Consistency lists tracking issues for individual block supports.

Props to @annezazu and @juanmaguitar for review.

#6-6, #dev-notes, #dev-notes-6-6, #editor

Site-wide background images in WordPress 6.6

In WordPress 6.6 you can define site-wide background images in theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. and the Site Editor.

A โ€œsite-wideโ€ background image is one whose value is set on the body element using theย background-imageย CSSCSS Cascading Style Sheets. property, and, therefore, appears on every page of a site.

An example might be a photo that stretches with the window size, or a repeating pattern background.

To customize how background images appear, WordPress 6.6 supports the following background style properties:

  • background position
  • background size
  • background repeat

Usage

In theme.json

In theme.json, site-wide background images and their properties are defined underย "styles.background".

For example, as a single image URI inย styles.background.backgroundImage.url:

{
	"styles": {
		"background": {
			"backgroundImage": {
				"url": "<a href="http://path.to/some/image.png">http://path.to/some/image.png</a>"
			},
			"backgroundSize": "cover"
		}
	}
}

For the above, WordPress will automatically wrap the image in the CSSย url()ย function.

styles.background.backgroundImageย also accepts string values, which can be any valid CSS value forย background-imageย :

{
	"styles": {
		"background": {
			"backgroundImage": "url(<a href="http://path.to/some/image.png">http://path.to/some/image.png</a>)",
			"backgroundPosition": "center"
		}
	}
}

The above examples use absolute paths to image files. Such files would need to be hosted and maintained.

Most likely, theme developers will want to define background images using paths to a themeโ€™s own assets. This ensures that the theme is self-contained and portable.

Relative paths to theme assets are defined using theย file:./ย prefix:

{
	"styles": {
		"background": {
			"backgroundImage": {
				"url": "file:./assets/my-theme-background.jpg"
			},
			"backgroundSize": "cover"
		}
	}
}

Paths are resolved on the backend usingย get_theme_file_uri.

Paths defined this way must beย relative to the theme root, regardless of where the theme.json sits in your themeโ€™s directory. This follows anย existing pattern for web fonts.

Despite the dot inย file:./, the special symbols dot (.) and double dot (..) for directory navigation are not supported in theme.json relative paths. This means, for example, that theme style variation files, which reside under theย style/ย directory, would use the same path as the themeโ€™s main theme.json.

Anย issueย exists to make the syntax more consistent.

In the Site Editor

Background images can be also be uploaded, and their properties tweaked through the Site Editorโ€™s styles panel.

In WordPress 6.6, background image controls are located underย Styles > Layout.

The styles panel navigation isย undergoing reviewย however, so in upcoming versions the location may change.

As well as setting new background images, itโ€™s possible toย โ€œremoveโ€ a themeโ€™s default background imageย in the Site Editor.

Relative paths to any images in theme.json are resolved on the backend, and are sent in theย _linksย array of Global Styles REST responses. The Editor uses the resolved values to generate theme CSS in the client.

Limitations

In WordPress 6.6, the ability to define background images in theme.json exists only for top-level styles. Top-level styles apply to the body element. Anย open PRย aims to also enable the feature at the blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. level in the next WordPress release.

Work is also underway to:

  • add supportย for fixed images, using theย background-attachmentย CSS property.
  • avoid conflicts between gradient backgrounds, whose values are currently set to theย backgroundย property, andย background-image. The proposal is that gradient backgrounds will also be set toย background-image, and, where both an image and a gradient are defined, their values are merged .

Backwards compatibility

WordPress already has support forย custom site-wide background images in the Customizer. The theme.json variant will not affect themes that have enabled this feature.

Background images added in the CustomizerCustomizer Tool built into WordPress core that hooks into most modern themes. You can use it to preview and modify many of your siteโ€™s appearance settings. take precedence over those set in theme.json or in the Site Editor.

Anย ongoing discussionย seeks to harmonize the two features.

Whatโ€™s next

Progress on upcoming work is tracked onย Background Image block support follow-up tasks.

Props to @andrewserong and @juanmaguitar for review

#6-6, #core-editor, #dev-note, #dev-notes, #dev-notes-6-6, #gutenberg

What’s new in Gutenberg 18.6

โ€œWhatโ€™s new in GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses โ€˜blocksโ€™ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/โ€ฆโ€ posts (labeled with the #gutenberg-new tag) are posted following every Gutenberg release on a biweekly basis, showcasing new features included in each release. As a reminder, hereโ€™s an overview of different ways to keep up with Gutenberg and the Editor.


Gutenberg 18.6 has been released and is available for download!

51 contributors have shipped 157 pull requests in this release, and a big welcome to four new contributors. With WordPress 6.6 rapidly approaching, many contributors are focusing on bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. fixes, with this release including a total of 62 fixes. There are still some great features being worked on, and this release introduces the new background image feature to several blocks.

Thanks to everyone involved in this release! ๐Ÿ‘

  1. Background image support for Quote, Verse and Post Content blocks
  2. DataViews: Extensibility APIs
  3. Changelog
  4. First-time contributors
  5. Contributors

Background image support for Quote, Verse and Post Content blocks

Screenshot of the quote block with a background image
Screenshot of the verse block with a background image

Freshen up the look of the quote, verse, and post content blocks using the new background image feature.

Previously, options for background images were limited to container blocks like the Cover and Group blocks, but with the feature now supported across several blocks, itโ€™s easier for users to attain the look they want without nesting blocks.

Follow all the work on background images in the GitHub tracking issue.

DataViews: Extensibilty APIs

Very early work on extensibility for DataViews was shipped in this release.

โ€˜DataViewsโ€™ is the component that powers the post listing views available in the Site Editor, and in the future will become an important part of the new adminadmin (and super admin) design project.

The APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. being explored will allow the registration of actions for different โ€˜entitiesโ€™ (post types and other types of data represented by the listings). Right now, the API is private to the Gutenberg PluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. and will undergo further development and testing before being made public for third parties.

Find out more in the GitHub pull request for the feature, and read the recent update on DataViews for more background on the work.

Changelog

Enhancements

Design Tools

  • Post content blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience.: Add background image and padding support. (62499)
  • Quote blocks: Add background image and minimum height support. (62497)
  • Verse block: Add background image and minimum height support. (62498)

Block Library

  • Post Date & Comment Date: Add relative date format. (62298)
  • Replace โ€œAdd new postโ€ link text with more meaningful Label (v2). (62277)

Block Editor

  • LinkControl: Refined the display of the link preview title and URLURL A specific web address of a website or web page on the Internet, such as a websiteโ€™s URL www.wordpress.org when both are same. (61819)
  • Update URL to uppercase. (62231)

Block bindings

  • Change bindings panel title, add description. (62489)

Site Editor

  • Unify DataViews HeaderHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitorโ€™s opinion about your content and you/ your organizationโ€™s brand. It may also look different on different screen sizes. Title & Subtitle. (62429)
  • Template inspector: Small visual adjustments. (62537)

Document Settings

  • FlatTermSelector: Update the term suggestion limit. (62359)

Global Styles

  • Update custom CSSCSS Cascading Style Sheets. handling to be consistent with block global styles. (62357)

Post Editor

  • Try: Re-enable ReactReact React is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org StrictMode. (61943)

New APIs

Extensibility

  • DataViews: Bootstrap Actions Extensibility API. (62052)

Bug Fixes

  • CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. Data: Fix errors when the entities list doesnโ€™t contain configuration key. (62346)
  • Data Views: Bulk toolbar covering other clickable elements. (62333)
  • Fix: Omit default parameters from pages, template parts, and patterns. (62372)
  • Fix: Show homepage link on frontpage instead of the slug. (62279)
  • Fix: Unquoted file argument in declaration check script. (62482)
  • List: Fix pasting. (62428)
  • Revert CSS removal for interface footer breadcrumbs. (62309)
  • Revert test data forย WithSlugย variation. (62579)
  • Scripts: Pin the wordpress/scripts version to a version supported by 6.5. (62234)
  • Site Editor Hub: Simplify. (61579)
  • Style Book: Allow activation when the canvas mode is โ€œviewโ€. (62212)
  • Top toolbar: Fix half a pixel artifacting of the bottom border. (62225)
  • Try: Contextual frame bg color to avoid artifacting. (62223)
  • Try: Fix mover positioning. (62226)
  • Update instances of text-wrap: Pretty to fall back to balance. (62233)
  • MediaUpload: Remove dialog markup on close. (62168)

Global Styles

  • Addย default-spacing-sizesย andย default-font-sizesย options for classic themes. (62252)
  • Add custom CSS for block style variations. (62526)
  • Color Variations: Use Grid rather than VStack. (62445)
  • Donโ€™t apply the background and text colors to typography previews. (62578)
  • Fix UIUI User interface appearing on blocks that donโ€™t support text alignment. (62376)
  • Fix UI order for theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. spacing sizes. (62199)
  • Fix registration of theme style variation defined block styles. (62495)
  • Only use single property variations as color/type presets. (62469)
  • Section Styles: Register block style variations onย init. (62461)
  • Section styles: Consolidate variation name. (62550)
  • Section styles: Support i18ni18n Internationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill. for variations declared inย theme.jsonย or theme style variations. (62552)
  • Sort spacing sizes when all slugs begin numerically. (62567)

Site Editor

  • Changeย Site Editorย toย Edit site. (62501)
  • Fix โ€œinsert before/afterโ€ not showing for blocks in site editor. (62530)
  • Site Export: Ensure that the export endpoint uses Gutenberg theme classes. (61561)
  • Update old document URLs to new ones. (62206)
  • Update sidebarSidebar A sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme. title + icon + site title alignment. (62191)

Block Editor

  • Inserter: Allow focus to move to the toggle when opening the inserter. (62513)
  • Inserter: Return the same items when the state and parameters donโ€™t change. (62263)
  • Remove โ€˜rootClientIdโ€™ argument for block lock selectors. (62547)
  • Update fetchLinkSuggestions to sort results by relevancy. (62397)

Block Library

  • Fixed Media Text Block Issue : When crop image to fill is enabled, the image in nested media & text blocks does not show. (62182)
  • Media & Text block: Fix nested Media & Text block media position issue with increased CSS specificity. (62184)
  • Query: Adjust the position of sticky search field in Patterns modal. (62370)

Post Editor

  • Editor: Avoid remounts ofย DocumentBar. (62214)
  • Editor: Make revisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision. more prominent. (62323)
  • Editor: Refine availability of rename post action. (62248)
  • Fix moveย CONTENT_ONLY_BLOCKSย into component body to ensure theย editor.postContentBlockTypesย filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. gets called whenever the values are used. (62292)

Components

  • Ensure that openref is defined before accessing to .current. (62508)
  • Fix: Update styles for checkbox and radio controls. (61696)
  • Tabs: Prevent accidental overflow in indicator. (61979)

List View

  • Fix home and end key behaviour in very long lists. (62312)
  • Respect default shortcuts in modals. (62479)
  • Show context menu for content-only blocks in posts. (62354)

Block bindings

  • Fix applying bindings or pattern overrides to button blocks with empty text. (62220)
  • Fix site editor breaking when user selects bound and non-bound blocks at the same time. (62268)
  • Revert changes to bindings replacement logic to not use regex. (62355)

Synced Patterns

  • Block Bindings / Pattern Overrides: Prevent normal attribute updates when a __default binding exists. (62471)
  • Fix showing double icons for connected blocks in pattern editor. (62317)

Data Views

  • DataViews: Fix unnecessary horizontal scrollbar in list layout. (62448)
  • Page creation and duplication: Decode HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. entities in success notices. (62313)

Patterns

  • Fix increasingly big canvas in the post editor when editing patterns. (62360)
  • i18n: Patterns: Disambiguate singular & plural uses of โ€˜Syncedโ€™ & โ€˜Unsyncedโ€™. (62375)

Data Layer

  • Data: Add error handle to the โ€˜registry.batchโ€™ method. (62322)

Block Variations

  • Compare objects based on given properties. (62272)

Block Styles

  • Remove core block style variations filters and action. (62090)

AccessibilityAccessibility Accessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both โ€œdirect accessโ€ (i.e. unassisted) and โ€œindirect accessโ€ meaning compatibility with a personโ€™s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility)

  • Add lint rule for inaccessible disabledย Button. (62080)
  • Placeholders: Fix contrast. (62416)

Global Styles

  • Display tooltips for pagination buttons on styles revision. (62395)

Site Editor

  • Make edit site pagination buttons accessibly disabled. (62267)

Performance

  • reporter: Print the stdout/stderr from the worker. (62316)

Block bindings

  • Only run block bindings Gutenberg logic for sites using WordPress versions below 6.5. (62363)

Interactivity API

  • Use data-wp-on-async directives in core blocks when handler does not need synchronous access to event. (62160)

Experiments

Posts/Tags/Categories Screen

  • Bootstrap the dashboard layout. (62409)
  • Posts Dashboard: Add a new experimental empty page. (62406)

Documentation

  • Addย @globalย PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 7.4 or higher documentation. (60539)
  • Add documentation for PostSticky and PostStickyCheck component. (62100)
  • Add documentation for WordCount component. (62217)
  • Added documentation forย PostTrashย &ย PostTrashCheckย TimeToReadย TextEditorGlobalKeyboardShortcutsย PostPublishButtonLabel Component. (62116)
  • Better changelogs for the JSX transform upgrade. (62265)
  • Correctedย @SInCEย Order in Php documentation. (61992)
  • Docs: Explicitly mention new behavior coming in WP 6.6 for block variations. (62399)
  • EntitiesSavedStates editor component. (62377)
  • Fixย @sinceย tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.) in docblockdocblock (phpdoc, xref, inline docs) inย WP_Theme_JSON_Data_Gutenberg. (62425)
  • Fix: Invalidinvalid A resolution on the bug tracker (and generally common in software development, sometimes also notabug) that indicates the ticket is not a bug, is a support request, or is generally invalid. link on explanations documentation. (62487)
  • Fixing minor syntax in DataView example code. (62560)
  • Interactivity API template create block: Removed warning for generated README from template. (62324)
  • PostPublishButton, PostPublishButtonLabel editor components. (62379)
  • PostPublishPanel editor component. (62380)
  • PostSwitchToDraftButton editor component. (62381)
  • PostSyncStatus editor component. (62382)
  • PostTaxonomies, PostTaxonomiesCheck, PostTaxonomiesFlatTermSelector, PostTaxonomiesPanel related editor components. (62384)
  • Several typo correction in documentations. (62433)
  • TableOfContents editor component. (62385)
  • ThemeSupportCheck editor component. (62387)
  • Update React API reference links in wordpress/element reference-guides. (62475)
  • Update: Slotfill documentation samples (links, code, and rephrase). (62271)
  • UseEntitiesSavedStatesIsDirty editor component. (62388)
  • block.json schema: Add supports.splitting field. (62209)

Code Quality

  • Add support for local keyframes through a PostCSS plugin. (62476)
  • Block style variation: Rename hook. (62464)
  • Chore: Simplify a padding style on global styles. (62291)
  • Convert autop package to TS. (62583)
  • Convert blob package to TS. (62569)
  • Convert escape-html package to TS. (62586)
  • Convert token-list package to TypeScript. (62584)
  • Convert warning package to TS. (62557)
  • Editor: Cleanup styles and classnames. (62237)
  • Editor: Deprecate PostSwitchToDraftButton. (62402)
  • Editor: Introduce the Editor component and use it in the site editor. (62274)
  • Fix unintended overwrite of eslintย no-restricted-syntax. (62301)
  • Fix: Addย network-activeย to valid options inย PluginStatusย Type definition. (62450)
  • Fix: Flakey deferred store test. (62571)
  • Fix: Remove unused code from dataviews styles. (62275)
  • Fix: Remove unused typography panel styles. (62295)
  • Fixed : Disambiguate โ€œCoverโ€ translatable string in the context of background-panel.js. (62440)
  • Move the template part menu items to the editor package. (62366)
  • Shortcut Help modal: Remove CSS hack for Internet Explorer 11. (62564)
  • Use stable reference forย getEntityActionsย action. (62536)

Global Styles

  • Global styles code quality refactoring. (62299)
  • Migrate theme.json based on origin. (62305)
  • Send theme object to setUserConfig. (61805)

Synced Patterns

  • Extract the pattern overrides toolbar indicator from theย block-editorย package. (62514)
  • Remove unusedย syncDerivedUpdatesย action. (62229)

Post Editor

  • Editor: Combine selector in provider component. (62407)
  • Editor: Use the Editor component in the post editor. (62339)

Site Editor

  • Remove editor specific classes from shell wrapper. (62389)
  • Remove unused code. (62286)

Icons

  • Fix React warning error for offline icon. (62353)

Data Views

  • Chore: Simplify a padding style on dataviews. (62276)

Block Editor

  • Use border instead of hr for filtered block list separator. (62249)

Block bindings

  • Use preview instead of publishing post in block bindings tests. (62235)

Block API

  • Parser: Update validateBlock to use fixedBlock. (62178)

Tools

Testing

  • Fix flaky Site Editor command center end-to-end test. (62454)
  • Perf Tests: Use backward-compatible locators. (62362)
  • Test using Node.js 22.x. (62341)
  • Try: Fix flaky DataViews end-to-end test. (62413)
  • Update Node version for flaky test reporter. (62401)
  • end-to-end Utils: Add retry mechanism to the REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think โ€œphone appโ€ or โ€œwebsiteโ€) can communicate with the data store (think โ€œdatabaseโ€ or โ€œfile systemโ€) https://developer.wordpress.org/rest-api/ discovery. (62331)

Build Tooling

  • Build JSJS JavaScript, a web scripting language typically executed in the browser. Often used for advanced user interfaces and behaviors. module only in development mode. (62398)
  • Speed up check-build-type-declaration-files. (62538)

wp-env

  • Add JSON Schema forย .wp-env.jsonย files. (36276)
  • Addย WP_ENV_TESTS_MYSQL_PORTย /ย .wp-env.jsonย .env.tests.mysqlPortย option etc. (61057)

Various

  • Update allย ConfirmDialogs in the codebase to be size=medium. (62532)

REST API

  • Themes REST API endpoint: Add stylesheet_uri and template_uri fields to the response (WP 6.6). (62211)

First-time contributors

The following PRs were merged by first time contributors:

  • @aaronware: Fixing minor syntax in DataView example code. (62560)
  • @BrianHenryIE: Addย WP_ENV_TESTS_MYSQL_PORTย /ย .wp-env.jsonย .env.tests.mysqlPortย option etc. (61057)
  • @carstingaxion: Replace โ€œAdd new postโ€ link text with more meaningful Label (v2). (62277)
  • @up1512001: Changeย Site Editorย toย Edit site. (62501)

Contributors

The following contributors merged PRs in this release:

@aaronrobertshaw,ย @aaronware,ย @afercia,ย @ajlende,ย @akasunil,ย @amitraj2203,ย @andrewserong,ย @BrianHenryIE,ย @carolinan,ย @carstingaxion,ย @cbravobernal,ย @colorful-tones,ย @DaniGuardiola,ย @desrosj,ย @ellatrix,ย @fabiankaegy,ย @geriux,ย @gigitux,ย @gziolo,ย @jameskoster,ย @jasmussen,ย @jeryj,ย @joemcgill,ย @jorgefilipecosta,ย @jsnajdr,ย @juanmaguitar,ย @kevin940726,ย @Mamaduka,ย @mcsf,ย @mirka,ย @narenin,ย @noisysocks,ย @ntsekouras,ย @oandregal,ย @ockham,ย @ramonjd,ย @richtabor,ย @SantosGuillamot,ย @scruffian,ย @shail-mehta,ย @sirreal,ย @stokesman,ย @t-hamano,ย @talldan,ย @tellthemachines,ย @tjcafferkey,ย @up1512001,ย @vipul0425,ย @westonruter,ย @WunderBart,ย @youknowriad

Props toย @jameskosterย for the visual assets,ย @priethor for handling the release candidaterelease candidate One of the final stages in the version release cycle, this version signals the potential to be a final release to the public. Also see alpha (beta). at short notice, @andrewserong, @isabel_brison, @annezazu, and @matveb for help with drafting and proof reading this post.

#block-editor, #core-editor, #gutenberg, #gutenberg-new

Theme.json version 3

The theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. version is incremented whenever a breaking change would need to be made to the APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.. This allows consumers to opt-in to the breaking change by updating the version. Older theme.json versions will always be supported in the latest versions of WordPress.

Updating to version 3 is recommended when your minimum supported WordPress version reaches 6.6. See theme.json version 3 frequently asked questions for more information on when to update. Then check out the theme.json reference for migrationMigration Moving the code, database and media files for a website site from one server to another. Most typically done when changing hosting companies. instructions when you are ready to update.

Breaking changes in version 3

Starting with theme.json version 3 the default behavior for using the same slugs as the default fontSizes and spacingSizes presets has been changed to match how other theme.json presets work: from always overriding the default presets to requiring defaultFontSizes or defaultSpacingSizes to be false in order to override the default presets.

Default font sizes

settings.typography.defaultFontSizes is a new option in theme.json v3. It controls whether the coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. provided default settings.typography.fontSizes presets are shown and used.

The default fontSizes presetsโ€™ slugs are: small, medium, large, and x-large.

  • When defaultFontSizes is true it will show the default font sizes in the editor and prevent the theme from creating presets using the default slugs.
  • When defaultFontSizes is false it will hide the default font sizes in the editor and allow the theme to use the default slugs.

For blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. themes defaultFontSizes is true by default. This is consistent with how other default* options work such as settings.color.defaultPalette.

For classic themes there is a new theme support default-font-sizes which is also true by default. However, unlike block themes, it is set to false when editor-font-sizes theme support is defined.

In theme.json v2, the default font sizes were only shown when theme sizes were not defined. A theme providing font sizes with the same slugs as the defaults would always override the defaults.

To keep behavior similar to v2 with a v3 theme.json:

  • If you do not have any fontSizes defined, defaultFontSizes can be left out or set to true.
  • If you have some fontSizes defined, set defaultFontSizes to false.
--- theme.json v2
+++ theme.json v3
@@ -1,24 +1,25 @@
 {
-	"version": 2,
+	"version": 3,
 	"settings": {
 		"typography": {
+			"defaultFontSizes": false,
 			"fontSizes": [
 				{
 					"name": "Small",
 					"slug": "small",
 					"size": "10px"
 				},
 				{
 					"name": "Medium",
 					"slug": "medium",
 					"size": "14px"
 				},
 				{
 					"name": "Large",
 					"slug": "large",
 					"size": "20px"
 				}
 			]
 		}
 	}
 }

Default spacing sizes

settings.spacing.defaultSpacingSizes is a new option in theme.json v3. It controls whether the core provided default settings.spacing.spacingSizes presets are shown and used.

The default spacingSizes presetsโ€™ slugs are: 20, 30, 40, 50, 60, 70, and 80.

  • When defaultSpacingSizes is true it will show the default spacing sizes in the editor and prevent the theme from creating presets using the default slugs.
  • When defaultSpacingSizes is false it will hide the default spacing sizes in the editor and allow the theme to use the default slugs.

defaultSpacingSizes is true by default. This is consistent with how other default* options work such as settings.color.defaultPalette.

For classic themes there is a new theme support default-spacing-sizes which is also true by default. However, unlike block themes, it is set to false when editor-spacing-sizes theme support is defined.

In theme.json v2, the default spacing sizes were only shown when theme sizes were not defined. A theme providing spacing sizes with the same slugs as the defaults would always override the defaults.

Furthermore, there are two settings that can be used to set theme level spacing sizes: spacingSizes and spacingScale. With theme.json v3, presets from both will be merged together and sorted numerically by slug. Presets defined in spacingSizes will override those generated by spacingScale if the slugs match.

In theme.json v2, setting both spacingSizes and spacingScale would only use the values from spacingSizes.

To keep behavior similar to v2 with a v3 theme.json:

  • If you do not have any spacingSizes presets or spacingScale config defined, defaultSpacingSizes can be left out or set to true.
  • If you disabled default spacing sizes by setting spacingScale to { "steps": 0 }, remove the spacingScale config and set defaultSpacingSizes to false.
  • If you defined only one of either spacingScale or spacingSizes for your presets, set defaultSpacingSizes to false.
  • If you defined both spacingScale and spacingSizes, remove the spacingSizes config and set defaultSpacingSizes to false.
--- theme.json v2
+++ theme.json v3
@@ -1,27 +1,25 @@
 {
-	"version": 2,
+	"version": 3,
 	"settings": {
 		"spacing": {
-			"spacingScale": {
-				"steps": 0
-			},
+			"defaultSpacingSizes": false,
 			"spacingSizes": [
 				{
 					"name": "Small",
 					"slug": "40",
 					"size": "1rem"
 				},
 				{
 					"name": "Medium",
 					"slug": "50",
 					"size": "1.5rem"
 				},
 				{
 					"name": "Large",
 					"slug": "60",
 					"size": "2rem"
 				}
 			]
 		}
 	}
 }

Props to @scruffian and @juanmaguitar for assistance with writing and reviewing this post.

#6-6, #dev-note, #dev-notes, #dev-notes-6-6

Social Links block changes in WordPress 6.6

WordPress 6.6 includes some changes affecting both the social link and social links blocks.

HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. changes when using a social links blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. inside a Navigation Block

As of WordPress 6.6, the social links block will be wrapped in a list item (li tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.)) when used in the navigation block. This change fixed an issue where the navigation block produced invalidinvalid A resolution on the bug tracker (and generally common in software development, sometimes also notabug) that indicates the ticket is not a bug, is a support request, or is generally invalid. HTML (the social links blockโ€™s ul was nested directly under the navigation blockโ€™s ul).

This may affect some themes that depend on the exact nesting of the HTML elements, for example using a selector like .wp-block-navigation__container > .wp-block-social-links.

Here are some examples of how the HTML has changed:

Example of navigation block and social links markup before WordPress 6.6

<ul class="wp-block-navigation__container wp-block-navigation">
  <ul class="wp-block-social-links is-layout-flex wp-block-social-links-is-layout-flex">
  </ul>
</ul>

Example of navigation block and social links markup after WordPress 6.6

<ul class="wp-block-navigation__container wp-block-navigation">
  <li class="wp-block-navigation-item">
    <ul class="wp-block-social-links is-layout-flex wp-block-social-links-is-layout-flex">
    </ul>
  </li>
</ul>

Class name changes to the social link block

As of WordPress 6.6, the social link block will no longer output the components-button class name on its button element within the block editor.

Themes targeting this class name for editor styles should use the existing wp-block-social-link-anchor class instead.

Itโ€™s expected that most themes will be doing this already, so for most no change will be required.

Why was this class name present?

The class name was a side-effect of using the Button ReactReact React is a JavaScript library that makes it easy to reason about, construct, and maintain stateless and stateful user interfaces. https://reactjs.org component from the @wordpress/components package (which can also be referenced as wp.components.Button) within the social link blockโ€™s implementation.

Why is this being changed?

  • The components from @wordpress/components are intended for use in the editorโ€™s general interface and have a lot of opinionated CSSCSS Cascading Style Sheets., while the on-canvas part of a block is intended to be styled by a theme and should have minimal CSS.
  • Updates made to styles in the @wordpress/components can have unintended side-effects for the blockโ€™s appearance, and can also raise or lower the specificity of the styles above or below what a theme implementer might expect. The change to the blockโ€™s implementation leads to more stable and predictable css specificity.
  • Thereโ€™s no guarantee the styles from @wordpress/components will continue to work in the iframed editor canvas, some CSS variable references in the styles were already not working as expected.
  • The styles that were previously added to the social link block contravene the CSS guidelines used by developers on the WordPress project.

Props to @ramonopoly and @juanmaguitar for review

#6-6, #dev-note, #dev-notes, #dev-notes-6-6

Hallway Hangout: Exploring Grid Layouts

More features to build responsive grid layouts are about to become available in the WordPress blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor. The user experience work is out of the experimental stage and will come to WordPress in 6.6. as a new Group block variation. Its flexibility and visual resizing options help users to assemble enticing layouts for their visitors.

The options includeย 

  • automatic or manual set columns allowing for resizing of grid cells andย 
  • set column and row spans individually.ย 
  • drag and drop modification in the canvas.ย ย 

Join us for a Hallway Hangout on Jun 26 at 11:00 am UTC to discuss the new features with developers, site builders and extenders.ย This session will cover a demo of the features and tools coming to WordPress 6.6 as well as what is in the works for 6.7. The Zoom link will be shared on the day of the event in the #outreach channel.

Props for review to @isabel_brison and @juanmaguitar

#grid-layout, #hallway-hangout, #outreach

Performance Chat Summary: 18 June 2024

Meeting agenda here and the full chat log is available beginning here on Slack.

Announcements

  • Welcome to our new members ofย #core-performance
  • Early WordPress 6.6ย BetaBeta A pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process.ย 2 performance results [GitHub issue]
  • WordCampWordCamp WordCamps are casual, locally-organized conferences covering everything related to WordPress. They're one of the places where the WordPress community comes together to teach one another what theyโ€™ve learned throughout the year and share the joy. Learn more.ย Europe highlights post [link]
  • Thanks to all who joinedย Contributor DayContributor Day Contributor Days are standalone days, frequently held before or after WordCamps but they can also happen at any time. They are events where people get together to work on various areas of https://make.wordpress.org/ There are many teams that people can participate in, each with a different focus. https://2017.us.wordcamp.org/contributor-day/ https://make.wordpress.org/support/handbook/getting-started/getting-started-at-a-contributor-day/ย at WordCamp Europe! [accomplishments]

Priority Items

  • WordPress performance TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. tickets
    • Current release (WP 6.6)
  • Performance Lab pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. (and other performance plugins)
    • Auto-Sizes for Lazy-Loaded Images
    • Embed Optimizer
    • Fetchpriority
    • Image Placeholders
    • Modern Image Formats
    • Optimization Detective
    • Performant Translations
    • Speculative Loading
  • Active priority projects

WordPress Performance Trac Tickets

Performance Lab Plugin (and other Performance Plugins)

  • @joemcgill Chrome 126 went stable last week, which includes support forย auto-sizes, so Iโ€™d encourage more folks to start testing theย Auto-sizes pluginย and provide feedback
  • @mukesh27 For PL plugin PRย #1298ย is ready for review
  • @westonruter Iโ€™ve been working on adding integration between Embed Optimizer and Optimization Detective, allowing the collected URLURL A specific web address of a website or web page on the Internet, such as a websiteโ€™s URL www.wordpress.org metrics to inform whether an embed should be lazy-loaded and if not (when in the initial viewport) to add preconnect links. This has exposed some limitations with the current implementation so Iโ€™ve been refactoring how the tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.) processor is leveraged which will make it much more powerful for extensions to apply optimizations. Currently still a draft but should be ready for review this week:ย https://github.com/WordPress/performance/pull/1302
  • @westonruter for Speculative Loading, thereโ€™s a PR now to implement support for the search form, but this currently requires a hack which has been reported upstream to Chromium to allow speculative loading prerenders for GET forms:ย https://github.com/WordPress/performance/pull/1297
  • @westonruter ready for review is another PHPStan PR to apply strict rules:ย https://github.com/WordPress/performance/pull/1241

Active Priority Projects

Improving the calculation of image size attributes

  • @mukesh27 For accurate sizes, we used a different approach for updating the sizes. Theย PR #1252ย is ready with those changes. If anyone has a moment, please take a look

Optimized Autoloaded Options

  • @joemcgill our only remaining task is to publish the dev notedev note Each important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase.. I saw that @adamsilverstein provided some minor feedback, which @pbearne has already addressed. I think itโ€™s probably read to go

Improved template loading

  • @thekt12 I have addressed feedback from @joemcgill โ€“ย ย https://github.com/WordPress/wordpress-develop/pull/6781. I still need to move this to GB as this is GB first issue
  • @joemcgill one of the things that Iโ€™ve been thinking about, related to these types of cachesโ€”where weโ€™re trying to add persistence to all sites via the use of transientsโ€”is what is the best way to avoid the extra DB query that gets made when you have a transient with a TTL value. It may be worth updating the transient APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. to allow for autoloading to be specified when setting the transient.

Open Floor

  • @joemcgill reminder about the new project board that weโ€™ve got set upย here. Iโ€™m curious if anyone is still using the older project boards on a regular basis. If not, I think we can remove them.

Our next chat will be held on Tuesday, June 25, 2024 at 15:00 UTC in the #core-performance channel in Slack.

#core-performance, #performance, #performance-chat, #summary

Agenda, Dev Chat, Wednesday June 19, 2024

The next WordPress Developers Chat will take place onย  Wednesday June 19, 2024 at 20:00 UTC in theย coreย channel onย Make WordPress Slack.

The live meeting will focus on the discussion for upcoming releases, and have an open floor section.

Additional items will be referred to in the various curated agenda sections, as below. If you haveย ticketticket Created for both bug reports and feature development on the bug tracker.ย requests for help, please do continue to post details in the comments section at the end of this agenda.

Announcements

WordPress 6.6 Beta 3 was released on June 18. Contributors are still focused on testing and fixing bugs discovered during betaBeta A pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process. testing.

Forthcoming releases

Next major releasemajor release A release, identified by the first two numbers (3.6), which is the focus of a full release cycle and feature development. WordPress uses decimaling count for major release versions, so 2.8, 2.9, 3.0, and 3.1 are sequential and comparable in scope.: 6.6

We are currently in the WordPress 6.6 release cycle. WordPress 6.6 Beta 3 was released on Tuesday, June 18. Please continue to test and leave feedback. You can read more about the features included in this release in the 6.6 source of truth.

Next maintenance release

No maintenance releases are currently being planned.

Next GutenbergGutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses โ€˜blocksโ€™ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ release: 18.6

Gutenberg 18.6 is scheduled for June 19 and will includeย these issues. This version will NOT be included in the WordPress 6.6 release.

Discussions

As weโ€™re in the middle of the 6.6 release cycle, weโ€™ll prioritize any items for this release. Please review the Editor Updates section of this agenda for a list of updates on several key features related to this release.

Highlighted Posts

Editor updates

You can keep up to date with the major Editor features that are currently in progress for 6.6 by viewing these Iteration issues.

Props to @annezazu for putting together these updates.

6.6 related:ย Donโ€™t expose pattern shuffle feature when content has been editedย could use some more feedback & a quick note that theย 6.6 Micrositeย has begun.

Outside of 6.6:

Tickets for assistance

Tickets for 6.6 will be prioritized.

Please include details of tickets / PRs and the links in the comments, and if you intend to be available during the meeting if there are any questions or you will be async.

Open floor

Items for this can be shared in the comments.

Props to @joemcgill for reviewing.

#agenda, #core, #dev-chat

Options API: Disabling autoload for large options

WordPress automatically loads multiple options with a single query on each page request in order to be more efficientโ€”a technique called โ€œautoloadingโ€. Prior to [57920], developers could control whether their option should be autoloaded by passing either "yes"/true or "no"/false to the third parameter of add_option() or update_option(). However, the decision to make that parameter optional, with a default value of "yes" has led to many options being loaded on every page unnecessarily (see #42441).ย 

Autoloading a large amount of data that is not used negatively impacts website performance, particularly when an option containing a large amount of data is not used.

[57920] introduces several changes to the Options APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. to optimize autoloading behavior.

Changes to the options API

To support this optimization for autoloading behavior, and to create a way to apply further optimizations going forward, the following changes to the Options API have been made.

New default $autoload value

The default value for the $autoload parameter of add_option() and update_option() is being changed from "yes" toย  null, to allow WordPress to differentiate between an option with an autoload value that is explicitly set, and one where it can dynamically determine whether an option should be autoloaded. As a result, there are now three recommended values for the autoload parameter:

  • true: always autoload; Use this when an option should load on every page to avoid an additional DB query.
  • false:ย  never autoload; Use this when an option is rarely used to avoid wasted data being loaded on every page.
  • null: maybe autoload; Allow the autoload value to be dynamically determined. By default, WordPress will still autoload options using the default value unless they contain large values (described below).

For backwards compatibility, the previous values of "yes" and "no" are still supported and mapped to true and false, respectively.

Updated database autoload values

Previously, all options were stored in the database with an autoload value of either โ€œyesโ€ or โ€œnoโ€. Starting with this change, the autoload value for newly updated options will now be one of the following values:

  • โ€˜onโ€™: Added with an explicit true value and MUST be autoloaded (needed on EVERY page).
  • โ€˜offโ€˜:โ€˜ Added with an explicit false value and MUST not be autoloaded (e.g. only used on a single adminadmin (and super admin) page) .
  • โ€˜autoโ€™: Added without an explicit value and will rely on WP default autoloading behavior. In WordPress 6.6 these SHOULD autoload, but the default may change in the future.
  • โ€˜auto-onโ€™: Added with a dynamically set to true value and SHOULD be autoloaded.
  • โ€˜auto-offโ€™: Added with a dynamically set to false value and SHOULD NOT be autoloaded.

No upgrade routine is planned for this change, so previously added options will still be stored with โ€œyesโ€ or โ€œnoโ€ values, which will be treated like โ€œonโ€ and โ€œoffโ€, respectively. If you have implemented any custom SQL to read or write autoload values, you should update them to use the new values.

Newly introduced public functions and filters

Several new functions and filters are available to make working with the new autoload values easier.

New Function

  • wp_autoload_values_to_autoload() โ€“ Returns all database values that should be autoloaded. Defaults to an array containing 'yes', 'on', 'auto-on', and 'auto'.

New Filters

  • wp_autoload_values_to_autoload โ€“ Edit the list of autoload values stored in the database values that should be autoloaded. At this time, the filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. only allows values to be removed.
  • wp_default_autoload_value โ€“ Determine the default autoload value for an option where no explicit value is passed. Return a boolean false value to disable autoloading.
  • wp_max_autoloaded_option_size โ€“ Modify the size threshold above which options will not be autoloaded by default. Defaults to 150000, i.e., 150k bytes.

Disabling autoload for large options

To address the issue of autoloading excessively large options, when an option is added via add_option() or an optionโ€™s value is changed via update_option(), WordPress will now dynamically disable the autoload behavior by checking the size of the value before updating the database. For any options that do not explicitly pass true to the $autoload parameter, a value that is greater than 150k bytes will no longer be set to autoload.

Preparing for this update

To prepare for this update, developers should update calls to add_option() and update_option() in their code to explicitly set an autoload value using the new preferred true or false values in order to control the autoload behavior for your options. Otherwise, continue using the default value to allow for autoload optimizations to be dynamically applied.

Ensuring a large option is still autoloaded

If you need to ensure a specific large option is autoloaded after this change and cannot directly change the code where that option is saved, you can make use of the new wp_default_autoload_value filter.

Note: Do this with care, and only for options that are needed on every page.

add_filter( 'wp_default_autoload_value', 'my_large_value_autoload', 10, 2 );

function my_large_value_autoload( $autoload, $option ) {
    if ( 'my-large-option' === $option ) {
        return true;
    }
    
    return $autoload;
}

Adjusting the threshold for large options

If you want to change the size threshold for when options should no longer be autoloaded, you can use the new wp_max_autoloaded_option_size filter. Increasing this value is not recommended, as it could lead to slower performance.

add_filter( 'wp_max_autoloaded_option_size', 'my_max_autoload_option_size' );

function my_max_autoload_option_size( $size ) {
    // Reduce the threshold for large sizes to 100K (Default is 150K).
    return 100000;
}

Auditing your site for large options

WordPress 6.6 will include a new Site Health check, which will display a critical issue that says โ€œAutoloaded options could affect performanceโ€ if the total size of your autoloaded options exceeds 800 KB.

To audit your site for large options that are currently being autoloaded, you can run an enhanced version of this same Site Health check by installing the Performance Lab plugin from the WordPress Performance Team. Once activated, the pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. will add additional information to the Site Health check so you can review and disable any options that do not need to be autoloaded in the Site Health check.

Screenshot of the advanced table shown by the Performance Lab plugin

Other changes to the Options API in WordPress 6.6

  • Introduce wp_prime_network_option_caches() to load multiple networknetwork (versus site, blog) options with a single database request (#61053)
  • Prime transient and transient timeout options in the transient and site transient APIs (#61193, #61053)
  • Update default autoload values used in coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. (#61045)
  • Add 'label' argument to register_setting() (#61023)

This post has been co-authored by @pbearne and @joemcgill

Props to @flixos90, @peterwilsoncc,@adamsilverstein, @mukesh27 and @desrosj
for contributing to and reviewing this post.

#6-6, #dev-note, #dev-notes, #dev-notes-6-6

Improvements to active block variation detection

WordPress 6.6 includes improvements to how a block variation is detected as active for a given blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. via the variationโ€™s isActive property. This property can be either a function (that compares block and variation attributes), or a string[] shorthand that specifies which of the variationโ€™s attributes to consider when comparing them to the blockโ€™s. The following changes affect only the string[] shorthand, which is now generally recommended over the function version.

Dot notation

Block variations can now use dot notation for โ€œobject pathsโ€ to specify โ€œnestedโ€ attributes in their isActive property. For example, if a blockโ€™s query attribute is an object, it is now possible to use the following shorthand notation for isActive to determine if a variation is active based on the query objectโ€™s postType property:

attributes: {
    query: {
        postType: 'post',
        order: 'desc',
        orderBy: 'date',
    },
},
isActive: [ 'query.postType' ]

This was previously only possible by using an isActive function:

isActive: ( blockAttributes, variationAttributes ) => {
    return blockAttributes.query.postType === variationAttributes.query.postType;
}

Highest specificity wins

If multiple variations have an isActive string array property that matches a given block, getActiveBlockVariation() will now return the one with the highest specificity. For example, take two variations of the same block, one with

attributes: {
    textColor: 'vivid-red',
},
isActive: [ 'textColor' ],

and another with

attributes: {
    textColor: 'vivid-red',
    backgroundColor: 'cyan-bluish-gray'
},
isActive: [ 'textColor', 'backgroundColor' ]

Now if a block instance has attributes textColor: vivid-red and backgroundColor: cyan-bluish-gray, both variationsโ€™ isActive criterion will match that block instance. In this case, the specificity of each match will be calculated as the length of each isActive array, and the matching variation with the highest specificity will be returned โ€” in this example, the second one.

Comparison of objects

If an isActive array item is an object, it was previously compared by reference. This has been fixed such that a block is considered to match a variation if it contains all the properties that the variation specifies for that object and if the properties have the same values. For example, the following variation

attributes: {
    query: {
        postType: 'post',
        order: 'desc',
        orderBy: 'date',
    },
},
isActive: [ 'query' ]

matches a block with its query attribute set to

{
    postType: 'post',
    order: 'desc',
    orderBy: 'date',
    offset: 10,
}

But it doesnโ€™t match

    postType: 'post',
    order: 'desc',
    offset: 10,

as the orderBy property thatโ€™s specified by the variation is missing.

Comparison of RichText

Finally, rich-text attributes are now compared correctly when used in a block variationโ€™s isActive array. For example:

<pre class="wp-block-syntaxhighlighter-code">attributes: {
    content: 'This is a <strong>warning</strong> message.',
},
isActive: [ 'content' ]</pre>

Conclusion

We hope that these improvements will make developersโ€™ lives easier when working with block variations. Theyโ€™re also meant to lay the foundations for some other enhancements weโ€™re planning to make to block variations during the next cycle (e.g., automatically added class names for variations, or variation aliases).

Props to @bph and @juanmaguitar for review

#6-6, #dev-note, #dev-notes, #dev-notes-6-6