Fixes a regression introduced in [58241] where selectors with pseudo elements are wrapped within `:where()` causing malformed CSS and the CSS rule(s) not being applied.
When processing custom CSS for blocks, this changeset:
* Strips the pseudo-elements from the original nested selector, performs the required wrapping in `:root :where`, then re-appends the pseudo-element selector with its leading combinators if present.
* Removes empty CSS rules.
It includes the PHP changes.
Reference:
* PHP changes from [https://github.com/WordPress/gutenberg/pull/63980 Gutenberg PR 63980].
Follow-up to [58241], [56812], [55216].
Reviewed by andrewserong.
Merges [58896] to the 6.6 branch.
Props aaronrobertshaw, wongjn, harlet7, dballari, ramonopoly, andrewserong, aristath, hellofromTonya.
Fixes#61769.
Built from https://develop.svn.wordpress.org/branches/6.6@58987
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes a regression introduced in [58241] which inadvertently bumped the specificity in a non-iframed editor for `.editor-styles-wrapper .is-layout-flow > *` from (0,1,0) to (0,2,0). This fix restores theme.json spacing rules taking precedence over the implicit spacing rules in a non-iframed editor.
**The What**
When the block editor is not iframed (which can happen when Custom Fields are active, or blocks that use and older `apiVersion` are present), style rules are processed using post css to append the `.editor-styles-wrapper` class name. This has the effect of scoping the the style rules to ensure they don't affect the editor chrome or admin.
With [58241], one of the rules was changed to `.is-layout-flow > *`. In a iframed editor, the specificity of this rule is okay (0,1,0), but in a non-iframed editor it becomes `.editor-styles-wrapper .is-layout-flow > *`, a specificity of (0,2,0). Comparing this to before [58241], the same rule was `.editor-styles-wrapper :where(body .is-layout-flow) > *` (specificity 0,1,0). This is a regression in specificity that has caused some issues. Notably themes can no longer properly override the spacing for blocks using theme.json and have the results correctly shown in the non-iframed editor.
**The How**
This changeset modifies the selector to `:root :where(.is-layout-flow) > *` (still specificity 0,1,0). `transformStyles` handles 'root' selectors a little differently, it'll instead replace the `:root` part so it becomes `.editor-styles-wrapper where(.is-layout-flow) > *` (keeping the specificity at 0,1,0).
The other layout selector that this affects is the `:first-child` `:last-child` selectors that are responsible for resetting margin at the start and end of a block list. They traditionally have a 0,2,0 specificity so that they can override both the above rule and any rules in the theme.json. Those selectors are also maintained at 0,2,0 with this change, they become something like `:root :where(.is-layout-flow) > :first-child`.
**References:**
* PHP changes from [https://github.com/WordPress/gutenberg/pull/64076 Gutenberg PR 64076].
Reviewed by andrewserong.
Merges [58890] to the 6.6 branch.
Follow-up to [58241], [58228], [55956], [54162].
Props talldanwp, aaronrobertshaw, andrewserong, markhowellsmead, ramonopoly, hellofromTonya, munyagu, apmeyer.
Fixes#61829.
Built from https://develop.svn.wordpress.org/branches/6.6@58986
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improves the `'admin_bar_menu'` docblock by adding recommendations for customizing / changing existing items.
It also improves the `wp_admin_bar_render()` function's docblock by removing the "most optimal point" sentence.
The [58748] changeset moved the user menu to a higher priority level (of `9991`) to achieve:
> so nodes added with higher priorities will still be shown visually before the user and recovery menu items, as they were prior to [58215].
When hooking into `'admin_bar_menu'` with a priority level less than 9991 and attempting to get the `'my-account'` node, `null` is returned. While the preferred approach is to hook into `'wp_before_admin_bar_render'`, the documentation of the `'admin_bar_menu'` action was previously misleading.
Follow-up to [58748], [58759].
Reviewed by joedolson.
Merges [58978] to the 6.6 branch.
Props michaelwp85, narenin, sabernhardt, joedolson, costdev, jorbin, hellofromTonya, mukesh27, pbiron.
Fixes#61738.
Built from https://develop.svn.wordpress.org/branches/6.6@58982
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When setting an an attribute value in the HTML API, WordPress may reject
an update based on rules in `kses`. In these cases, the return value from
an escaping function will be an empty string, and the HTML API should
reject the update. Unfortunately, it currently reports that it updates the
attribute but sets an empty string value, which is misleading.
In this changeset, the HTML API will refuse the attribute update and return
false to indicate as much when WordPress rejects the updates.
Reviewed by jorbin, hellofromTonya.
Merges [58844] to the 6.6 branch.
Follow-up to [58472].
Props amitraj2203, dmsnell, mukesh27.
Fixes#61719.
Built from https://develop.svn.wordpress.org/branches/6.6@58980
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [57715], headings on the About pages were given `text-wrap: balance`. This rule causes unexpected breaks in non-latin langauges, e.g., Japanese, Korean. This fix sets the text-wrap to `pretty` for browsers that support it, and uses `balance` for English-only.
Reviewed by hellofromTonya.
Merges [58976] to the 6.6 branch.
Props akshat2802, wildworks, ryelle, sabernhardt, hellofromTonya.
Fixes#60892.
Built from https://develop.svn.wordpress.org/branches/6.6@58979
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[58069] introduced calling sanitize_text_field() with $_REQUEST['autofocus'] (which is an array) and setting its default to a string. This fix restores the array data type for autofocus.
The fix also relocates the unslash for url, return, and autofocus before sanitizing.
Follow-up to [58069], [34269], [29026], [21028].
Reviewed by joedolson.
Merges [58804] to the 6.6 branch.
Props jamesros161, swissspidy, dlh, audrasjb, hellofromTonya, ironprogrammer, debarghyabanerjee.
Fixes#61561.
Built from https://develop.svn.wordpress.org/branches/6.6@58973
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Attach the submit event to the parent search form in the installed and add new theme screen. Following [58405], the submit event was no longer attached to an object that was able to handle form submissions.
Reviewed by hellofromTonya.
Merges [58914] to the 6.6 branch.
Follow-up to [58405].
Props nithi22, nithins53, josklever, the-ank, debarghyabanerjee, sabernhardt, jeherve, hellofromTonya.
Fixes#61578.
Built from https://develop.svn.wordpress.org/branches/6.6@58916
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevents the Site Health Debug tab from stalling when reporting directory sizes if the directory does not exist.
Reviewed by hellofromTonya.
Merges [58884] to the 6.6 branch.
Props clorith, aristath, narenin, kowsar89, hellofromTonya, ironprogrammer, shailu25.
Fixes#61638.
Built from https://develop.svn.wordpress.org/branches/6.6@58891
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Pre-WordPress 6.6, the `body` selector was used for styles associated with the body.
In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes.
This change reverts the specificity increase, styles again use the `body` selector.
Syncs PHP changes from https://github.com/WordPress/gutenberg/pull/63726.
Reviewed by hellofromTonya.
Merges [58856] and [58861] to the 6.6 branch.
Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromTonya.
Fixes#61704.
Built from https://develop.svn.wordpress.org/branches/6.6@58874
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In some cases, derived state returns an associative array. Directives may wish to continue to access properties of the associative array, when using the syntax `state.arrayReturnedByClosure.property`. This patch continues evaluating the path after the associative array has been returned by the Closure.
Reviewed by adamsilverstein and gziolo.
Merges [58825] to the 6.6 branch.
Props jonsurrell, luisherranz, adamsilverstein, gziolo.
Fixes#61741.
Built from https://develop.svn.wordpress.org/branches/6.6@58869
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ensures that the arguments are correctly interpreted when passed as a query string, i.e. when `wp_parse_args()` is involved. For example, `wp_list_pages( 'depth=0' )` should display a list of all pages to the maximum depth.
Follow-up to [57848].
Reviewed by peterwilsoncc.
Merges [58812] to the 6.6 branch.
Props freibergergarcia, peterwilsoncc, ahortin.
Fixes#61749.
Built from https://develop.svn.wordpress.org/branches/6.6@58863
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The `inject_ignored_hooked_blocks_metadata_attributes` filter that is attached to both the `rest_pre_insert_wp_template` and `rest_pre_insert_wp_template_part` hooks receives a `stdClass` object from the Templates REST API controller that contains all fields that the client would like to modify when making a `POST` request (plus the `id` to identify the relevant template or template part, respectively).
There are cases when the `post_content` field is not set, e.g. when the client would like to rename an existing template (in which case it would only set the `title` field).
Prior to this changeset, the filter would erroneously apply the Block Hooks algorithm to the non-existent `post_content` field regardless, which would result in it being set to the empty string `''`. As a consequence, renaming a template would have the unwanted side effect of wiping its contents.
This changeset fixes the issue by returning early from the filter if the `post_content` field is not set.
Reviewed by gziolo.
Merges [58785] to the 6.6 branch.
Props alshakero, bernhard-reiter.
Fixes#61550.
Built from https://develop.svn.wordpress.org/branches/6.6@58802
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
#61182 introduced is_utf8_charset() as a way of standardizing checks for charset slugs referring to UTF-8. This is called by _mb_strlen() inside of compat.php, but is_utf8_charset() is defined in functions.php, which isn't loaded early on. Code calling mb_strlen() early on before functions.php loads in hosts without the multibyte extension therefore may crash.
Reviewed by hellofromTonya.
Merges [58763] to the 6.6 branch.
Props dmsnell, jonsurrell, joemcgill, jorbin.
Fixes#61680.
Built from https://develop.svn.wordpress.org/branches/6.6@58764
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
[58335] introduced `(string)` type casting of the passed in `$comment_id` value. If `$comment_id` is a scalar, it works as expected. But if it's an `object`, the following fatal error is thrown:
{{{
Object of class WP_Comment could not be converted to string
}}}
This fatal error happens when the incoming `$comment_id` is an instance of `WP_Comment` (or any object) without a `comment_ID` (empty).
This changeset adds tests to demonstrate the fatal error and validate the fix.
It fixes the fatal error by restructuring the ternary checks into an `if/elseif/else` structure for the 3 paths:
- When `$comment->comment_ID` is not empty, then it uses the property.
- When `$comment_id` is scalar, then it type casts it to a `string`.
- Else, the default is an empty `string`.
Follow-up to [58335], [41127], [52818].
Reviewed by SergeyBiryukov, jorbin.
Merges [58755,58756] to the 6.6 branch.
Props ambrosiawt, hellofromTonya, jorbin, mukesh27, SergeyBiryukov.
Fixes#61681.
Built from https://develop.svn.wordpress.org/branches/6.6@58762
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In the Layout block support, handle 0 values for padding as 0px in calc() rules. This resolves a bug for nested fullwidth layouts when zero padding is applied. Due to how calc() works, without supplying the unit, the rule will not
work, resulting in a horizontal scrollbar.
Ref: PHP changes from https://github.com/WordPress/gutenberg/pull/63436.
Reviewed by hellofromTonya.
Merges [58750] to the 6.6 branch.
Fixes#61656.
Props andrewserong, mukesh27, aaronrobertshaw.
Built from https://develop.svn.wordpress.org/branches/6.6@58761
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Following [58215], admin bar items in the top-secondary group have a changed visual order. Increase the priority of the user and recovery menu items so nodes added with higher priorities will still be shown visually before the user and recovery menu items, as they were prior to 58215.
The items will appear in the reverse of the previous order, but the new order now matches their priority order, rather than being the opposite.
Reviewed by hellofromTonya.
Merges [58748] to the 6.6 branch.
Props sabernhardt, joemcgill, pbiron, joedolson.
Fixes#61615.
Built from https://develop.svn.wordpress.org/branches/6.6@58759
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The CSS to make menu item containers resizable in the admin menu editor was too broadly scoped, and caused classic editor metaboxes to have unconstrained height. Limit the scope of the CSS changes to only impact menu item containers.
Reviewed by jorbin.
Merges [58747] to the 6.6 branch.
Props neotrope, sabernhardt, joedolson.
Fixes#61662.
Built from https://develop.svn.wordpress.org/branches/6.6@58758
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Prevent issues (e.g. links being underlined) caused by a bump in CSS specificity for top-level element-only global element styles.
Ref: PHP changes from https://github.com/WordPress/gutenberg/pull/63403.
Reviewed by hellofromTonya.
Merges [58749] to the 6.6 branch.
Props aaronrobertshaw, andrewserong, noisysocks, annubis, butterflymedia, clarktbt, hellofromTonya, jorbin, joedolson, swissspidy, courane01, raquelandefeld, talldanwp, markhowellsmead, youknowriad, poena, cbirdsong.
Fixes#61630, #61660.
Built from https://develop.svn.wordpress.org/branches/6.6@58751
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This reverts [58334] to fix a bug where edits to block styles made in the site editor were not showing in the front end.
Reviewed by hellofromtonya.
Merges [58710] to the 6.6 branch.
Props joemcgill, spacedmonkey, andrewserong, hellofromtonya, audrasjb.
See #59595.
Built from https://develop.svn.wordpress.org/branches/6.6@58711
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Fixes an issue where block style variations that use `ref` values to reference styles elsewhere in theme.json weren't working.
Retrieves reference values when generating styles for block style variations. How? When retrieving variation data, to generate styles from, also retrieve any referenced values.
Reviewed by audrasjb.
Merges [58691] to the 6.6 branch.
Props aaronrobertshaw, andrewserong, ramonopoly.
Fixes#61589.
Built from https://develop.svn.wordpress.org/branches/6.6@58699
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These changes prevent a flash of style updates for applied block style variations when the global styles data is loaded into the block editor. This is done by preloading the global styles REST API paths which also brings the post and site editors further into line.
Reviewed by audrasjb.
Merges [58690] to the 6.6 branch.
Props aaronrobertshaw, andrewserong, ramonopoly, ellatrix, hellofromTonya.
Fixes#61553.
Built from https://develop.svn.wordpress.org/branches/6.6@58698
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
As of [58457], the width and height cropping values are cast to an integer before the comparison to see if the target width and height differ from the original width and height.
Since they are now integers, it exposes a bug where the && of the if conditional meant that if you were only cropping in one dimension, the check wouldn't pass, and cropping would not occur.
In the block editor, the cropping tools are aspect ratio based, so one of the dimensions will always match that of the source image. Therefore, now that the values are cast as integers, the condition that allows a cropping to occur needs to be updated. If either width or height is different from the source image, then a crop should be allowed.
Follow-up to [50124], [58457].
Reviewed by davidbaumwald.
Merges [58612] to the 6.6 branch.
Props andrewserong, jrf, kevin940726.
Fixes#61514. See #59782.
Built from https://develop.svn.wordpress.org/branches/6.6@58692
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The images have been uploaded to the w.org CDN and added into the About page. Additionally, the link to the release page has been fixed, and an extra translator note about the escaped percent sign has been added.
Follow-up to [58568].
Reviewed by davidbaumwald.
Merges [58618] to the 6.6 branch.
Props ryelle, joen.
See #61320.
Built from https://develop.svn.wordpress.org/branches/6.6@58620
git-svn-id: http://core.svn.wordpress.org/branches/6.6@58053 1a063a9b-81f0-0310-95a4-ce76da25c4cd