#57618 closed enhancement (fixed)
Introduce sticky position block support
Reported by: | andrewserong | Owned by: | davidbaumwald |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | gutenberg-merge has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
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.
It would be good to backport this feature for the WP 6.2 release. While the feature is spread across JS and PHP code, it should be possible to land most of the PHP implementation in advance of the JS packages update for core.
The original feature landed in Gutenberg across the following PRs:
Change History (10)
This ticket was mentioned in PR #3973 on WordPress/wordpress-develop by @andrewserong.
22 months ago
#1
- Keywords has-patch has-unit-tests added
#3
@
22 months ago
- Owner set to flixos90
- Status changed from new to reviewing
I already reviewed https://github.com/WordPress/wordpress-develop/pull/3973 (almost good to go from my perspective), and I'm happy to commit this once it's ready.
@andrewserong commented on PR #3973:
22 months ago
#4
Thanks for reviewing @felixarntz!
Does this have to wait for the JS package update, or can it be committed to core before already?
This can be committed before the JS package update, since this PR doesn't opt any of the blocks into the new control, so it doesn't expose anything to a user. I think it's preferable to land this PR first, so that when the JS packages update happens, the PHP parts will already be in place.
#5
@
22 months ago
- Keywords commit added
As @flixos90 has approved for commit and @andrewserong confirmed it can be committed prior to package updates, marking for commit
.
This ticket was mentioned in Slack in #core by costdev. View the logs.
22 months ago
@davidbaumwald commented on PR #3973:
22 months ago
#9
Merged into core in https://core.trac.wordpress.org/changeset/55285.
This PR backports the PHP parts of the new sticky position block support, and is a follow-on from https://github.com/WordPress/wordpress-develop/pull/3865
Backports the PHP parts of the following PRs:
Notes on this backport:
fixed
position type is excluded from the appearance tools opt-in: this is because fixed positioning isn't being opted-in for the Group block and isn't ready to be used as a default opt-in. The code paths exist forfixed
positioning as it will be supported in the future, but for now,sticky
is the only one exposed by default. (The overall block support should still support it as a valid value, though)Screenshots:
| While logged in (CSS variable that's included in JS packages update isn't yet output in this PR, once it is the sticky block will sit below the admin bar) | While not logged in (correct) |
| --- | --- |
| | |
Testing instructions:
block.json
file add a"position": { "sticky": true }
object under"supports"
(Note: for this change to propagate in your testing, you might need to rebuild the block JSON cache locally).Group block markup for testing purposes:
{{{html
<div class="wp-block-group has-background" style="background-color:#f2aeae;padding-top:1em;padding-right:1em;padding-bottom:1em;padding-left:1em">
<p>A paragraph in a sticky group</p>
</div>
}}}
Trac ticket: https://core.trac.wordpress.org/ticket/57618