Skip to content

Add missing adjustments to "sticky" #67873

Open

Description

@burnuser

What problem does this address?

"position: sticky" - used in group block - needs (and allows!) in CSS two additional parameters:

  1. top / right / bottom / left
  2. a distance value

To allow full control of "sticky" both are valuable, but at least (2.) distance is needed!

Imagine the construction of a template with 2 elements:
A) A sticky Header with navigation and so on
B) A sticky sidebar with search, table of content, contact info, ...

To get an appropriate design, at the moment you must add manually (maybe as CSS class) the missing z-index to adjust the overlapping of two (or more) sticky elements. (And also when working with negative margins to get overlapping blocks!)
And you must play around with the content in the sidebar container to adjust padding/margin or placing some (not necessary) content at the top, which is hidden under the overlapping (z-index!) Header when both became sticky.

What is your proposed solution?

  1. Add "z-index" control to the adjustable Group parameters in the user-interface. (Resolves all overlapping needs of sticky and negative margins!)
  2. Add - at least - "distance" control to the "sticky" interface. (Allows trouble-free combination of several sticky elements!)
  3. Add - if possible - "top / right / bottom / left" control to the "sticky" interface. (Allows complete control of sticky positioning!)

Activity

  1. yogeshbhutkar commented on Dec 19, 2024

    @yogeshbhutkar
    Contributor

    Hi @burnuser,

    Thank you for bringing up this issue—it’s indeed a valuable feature to have. I’ve created a PR to address it. Appreciate your input!

    Thanks.

  2. burnuser commented on Dec 20, 2024

    @burnuser
    Author

    Thank You for Your quick and kind reaction!
    And especially for the solution!

    Some remarks / suggestions:

    1.) Add a "Top" default value of 0 to be compliant with existing "Sticky" implementation and without need of additional user-input in new interface.

    2.) Instead of (rectangle):
    Top - Right
    Bottom - Left

    consider field layout change to (diamond):
    Top (centered)
    Left - Right
    Bottom (centered)
    ... which would be more intuitive to understand, even without reading the labels.

    3.) Having your new interface (with or without suggested layout change), we have all needed elements for complete CSS position control and could - after having "sticky" - also add: "static", "relative" (= current group default), "absolute" and "fixed".
    As already discussed in Gutenberg forum as future interface extension ...

  3. yogeshbhutkar commented on Jan 9, 2025

    @yogeshbhutkar
    Contributor

    Hi @burnuser, apologies for the delayed response. I believe this issue requires design feedback before proceeding further.

  4. paaljoachim commented on Sep 12, 2025

    @paaljoachim
    Contributor

    I will ping @WordPress/gutenberg-design to comment on this issue.

  5. jasmussen commented on Oct 6, 2026

    @jasmussen
    Contributor

    It seems valid enough, and although #68123 is older and the position panel has since been rewritten, perhaps there's still something there to resurrect. I wonder if @andrewserong has any instincts?

  6. andrewserong commented on Oct 6, 2026

    @andrewserong
    Contributor

    Adding adjustments does seem a good idea, at least on the surface. Some challenges to implementing will be:

    • We currently output an offset for the logged in admin bar on the site frontend to ensure everything lines up. This will need to be factored in with any adjustments (i.e. if someone specifies a manual offset, should that factor in the admin bar or not?)
    • Many of these controls should be hidden by default instead of automatically shown as they'll only be used some of the time. As such, it might be worth refactoring the Position panel to use the ToolsPanel so that any additional controls can be hidden by default.

    In terms of capacity, I'm pretty full up on tasks (and my reviews focus) for the 7.2 cycle, so I likely won't be able to help out much in this area in the near-term, but hopefully the above notes might be of help if anyone is keen to dig into this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions