Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky positioning: nesting a sticky group block doesn't remove the sticky positioning #49903

Open
annezazu opened this issue Apr 18, 2023 · 4 comments
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

Description

First identified in slack with props to Tommaso Pirola: Sticky positioning shouldn't be available to blocks that are nested but, if you set sticky positioning in a group block, you can still nest it in another block, like a column block, and the sticky property will remain along with the UI.

@tellthemachines can you check this out? I'm adding to the 6.2.x board for now.

Step-by-step reproduction instructions

  1. Open the Appearance > Editor
  2. Add a Group block to the root of the editor.
  3. Make it sticky under Positioning settings in the block settings.
  4. Add a Columns block beneath this group block.
  5. Drag and drop the sticky group block into the Columns block.
  6. Notice the sticky positioning remains in the UI and the markup.

Screenshots, screen recording, code snippet

Here's what happens if you drag the group into a columns block:

sticky.bug.mov

Here's what happens if you drag the group into a template part:

sticky.bug.mov

Environment info

  • WP 6.2
  • GB 15.5.1 (with or without)
  • TT3

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Apr 18, 2023
@tellthemachines
Copy link
Contributor

Thanks for the ping! I don't think this is as much as bug as a side-effect of the current implementation. Sticky position only works if the sticky block is inside a scrollable container, but this isn't immediately obvious in the UI. There's some design/UX work still needed to work out the best way to make this limitation clear, so for the initial version it was easier to simply hide the controls for non-root blocks: see #47334. That's a temporary patch though; it's expected that eventually sticky position should be available for nested blocks too. Cc @andrewserong who has worked extensively on this issue.

@andrewserong
Copy link
Contributor

andrewserong commented Apr 19, 2023

Thanks for opening the issue! This was a known limitation when implementing #47334 as the hiding of sticky position for not-root levels was added after the sticky position support landed. So, to prevent breakages on existing sites and block markup where folks intentionally were using sticky position in other places (relative to a container block), we still needed to respect the position value if the block wound up in a non-root position. (An example of folks affected by the hiding of non-root sticky options is in this issue: #47892)

Rather than fix this bug directly, I think a better approach will be to consolidate around re-enabling sticky positioning at non-root positions and improving the UX for it. I have an early (very buggy, not yet ready for review) exploration in #49321, and the goal is to land a working version of it for 6.3.

@annezazu
Copy link
Contributor Author

Awesome! Thanks for the context and sharing the game plan. I'll remove for 6.2.x. Does this makes sense to leave open from ya'll's point of view? Will do so for now but happy to defer to other issues if it makes more sense.

@andrewserong
Copy link
Contributor

Does this makes sense to leave open from ya'll's point of view?

I'm happy for us to leave it open, so that if it's raised again at any point prior to landing support for non-root positions, we can point folks to the discussion here. We can then close out both this and #47892 once we have a permanent solution in place, if that sounds good to everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Bug An existing feature does not function as intended
Projects
Status: 💻 Needs development
Development

No branches or pull requests

3 participants