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 group, while logged in: Content is visible above the group on small screens #47566

Closed
carolinan opened this issue Jan 30, 2023 · 2 comments · Fixed by #47665
Closed

Sticky group, while logged in: Content is visible above the group on small screens #47566

carolinan opened this issue Jan 30, 2023 · 2 comments · Fixed by #47665
Assignees
Labels
[Block] Group Affects the Group Block (and row, stack and grid variants) [Type] Bug An existing feature does not function as intended

Comments

@carolinan
Copy link
Contributor

carolinan commented Jan 30, 2023

Description

When you are logged in, the sticky group block uses the --wp-admin--admin-bar--height to set the top value.
top: calc(0px + var(--wp-admin--admin-bar--height, 0px));

But at 600px width, the wp admin bar is no longer fixed, and it moves as you scroll.
Because the group is still sticky at this width, it sits 46px down from the top even though the admin bar is no longer visible.
The page content can be seen in this space as you scroll.

The video shows the Chrome dev tools, but I have also tested this with an android phone (also using chrome)

Step-by-step reproduction instructions

Activate Gutenberg trunk.
Please make sure that your WP install is set to show the admin bar.

In the site editor, add a group block at the very top.
Open the block settings, and select position, sticky.
Make sure there is some content on the rest of the page. Using two different background colors makes the bug easier to see.
Save and view the front of the site.
Reduce the browser window width to 600px or less.
Scroll. Confirm that the WP admin bar moves, but the sticky group does not.
As you scroll, the content on the page is visible between the sticky group and the top of the browser window.

Screenshots, screen recording, code snippet

Screen.Recording.2023-01-30.at.16.51.20.mov

Environment info

No response

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

@carolinan carolinan added [Block] Group Affects the Group Block (and row, stack and grid variants) [Type] Bug An existing feature does not function as intended labels Jan 30, 2023
@carolinan carolinan self-assigned this Jan 31, 2023
@carolinan
Copy link
Contributor Author

@andrewserong I have run into a bug with the sticky position, when the user is logged in and the screen width is 600px or smaller.
Since the style engine does not support media queries yet, I think we need a temporary fix where the position setting outputs a CSS class on the front, so that a media query can be added to the group block CSS. With this media query we can adjust the position when the admin bar is no longer fixed.
What do you think? Do you have any other suggestions?

I also think that developers will come asking for a class that identifies the state.

@andrewserong
Copy link
Contributor

Thanks for opening this one @carolinan! I think adding a CSS class to the frontend is a good pragmatic idea for this. I'll have a play around with that idea today.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 2, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Group Affects the Group Block (and row, stack and grid variants) [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants