Skip to content

Commit f7c2299

Browse files
committed
Editor: Introduce sticky position block support.
In the Gutenberg plugin, a position block support feature was introduced last year, that allows a Group block to be set to a "sticky" position, meaning that when the page scrolls, the block will stick to the top of the window. This change merges the "sticky" position feature for blocks introduced in Gutenberg 15.0. Props andrewserong, flixos90, mukesh27. Fixes #57618. git-svn-id: https://develop.svn.wordpress.org/trunk@55285 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8a2902d commit f7c2299

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/wp-includes/class-wp-theme-json.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ class WP_Theme_JSON {
304304
* and `typography`, and renamed others according to the new schema.
305305
* @since 6.0.0 Added `color.defaultDuotone`.
306306
* @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`.
307-
* @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', and 'shadow.defaultPresets'.
307+
* @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets',
308+
* `position.fixed` and `position.sticky`.
308309
* @var array
309310
*/
310311
const VALID_SETTINGS = array(
@@ -339,6 +340,10 @@ class WP_Theme_JSON {
339340
'definitions' => null,
340341
'wideSize' => null,
341342
),
343+
'position' => array(
344+
'fixed' => null,
345+
'sticky' => null,
346+
),
342347
'spacing' => array(
343348
'customSpacingSize' => null,
344349
'spacingSizes' => null,
@@ -513,7 +518,7 @@ public static function get_element_class_name( $element ) {
513518
* Options that settings.appearanceTools enables.
514519
*
515520
* @since 6.0.0
516-
* @since 6.2.0 Added `dimensions.minHeight`.
521+
* @since 6.2.0 Added `dimensions.minHeight` and `position.sticky`.
517522
* @var array
518523
*/
519524
const APPEARANCE_TOOLS_OPT_INS = array(
@@ -523,6 +528,7 @@ public static function get_element_class_name( $element ) {
523528
array( 'border', 'width' ),
524529
array( 'color', 'link' ),
525530
array( 'dimensions', 'minHeight' ),
531+
array( 'position', 'sticky' ),
526532
array( 'spacing', 'blockGap' ),
527533
array( 'spacing', 'margin' ),
528534
array( 'spacing', 'padding' ),

src/wp-settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@
336336
require ABSPATH . WPINC . '/block-supports/elements.php';
337337
require ABSPATH . WPINC . '/block-supports/generated-classname.php';
338338
require ABSPATH . WPINC . '/block-supports/layout.php';
339+
require ABSPATH . WPINC . '/block-supports/position.php';
339340
require ABSPATH . WPINC . '/block-supports/spacing.php';
340341
require ABSPATH . WPINC . '/block-supports/typography.php';
341342
require ABSPATH . WPINC . '/block-supports/settings.php';

tests/phpunit/tests/theme/wpThemeJson.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ public function test_get_settings_appearance_true_opts_in() {
274274
'dimensions' => array(
275275
'minHeight' => true,
276276
),
277+
'position' => array(
278+
'sticky' => true,
279+
),
277280
'spacing' => array(
278281
'blockGap' => false,
279282
'margin' => true,
@@ -301,6 +304,9 @@ public function test_get_settings_appearance_true_opts_in() {
301304
'dimensions' => array(
302305
'minHeight' => true,
303306
),
307+
'position' => array(
308+
'sticky' => true,
309+
),
304310
'spacing' => array(
305311
'blockGap' => false,
306312
'margin' => true,

0 commit comments

Comments
 (0)