-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Try: Sticky headers: Add "none" as a HTML tag option for template parts #48471
Conversation
Size Change: +22 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in 6c3421d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4279991932
|
Thanks for exploring this idea @carolinan! In principle I quite like the idea of being able to remove the template part wrapper, and I think I remember discussions elsewhere where folks were thinking about it, but I can't find the issue(s) at present.
I think this sounds like it could be a potential blocker, as there have been a lot of efforts made to ensure markup consistency between the editor and site frontend, and if users can't see the sticky positioning working as expected within the site editor, the mismatch between the two environments could be confusing. What do you think? |
What?
This is a test to see if we can make it easier to add sticky headers by allowing template parts not to have a HTML tag on the front of the website.
Why?
It is tricky to update an existing site header to be sticky because sticky groups do not work when nested inside a template part (They are stickied but only inside the closest parent).
Today, to make a header sticky, you need to create a new group, make it sticky, and move the template part inside the group. Then repeat that for every template.
If the template part had no HTML tag, the group would no longer be nested, and it would stick correctly to the browser window.
How?
By adding "None" as an option to the HTML tag selection in the Advanced panel in the block settings sidebar of the template part.
By not outputting the wrapping HTML tag and block wrapper attributes for template parts on the front of the website.
This works well if the site header follows a common pattern where a group is the first element inside the template part.
The caveat is that it only works for the front, the element in the editor must not be removed, so the front and editor do not match.
Testing Instructions
Save.
Screenshots or screencast