Grommet break the scroll to top on client side routing
See original GitHub issueThe property overflow: auto;
break the “scroll to top” on my website.
My website uses NextJS, and I found the solution from this issue.
Expected Behavior
Ideally, by default, the global style of Grommet should not break my website. Alternatively, I would like to be able to disable some properties set by grommet by default.
Actual Behavior
The routing is broken by the property overflow: auto;
.
I don’t know if this is NextJS related or Client Side Routing generally related.
URL, screenshot, or Codepen exhibiting the issue
https://drive.google.com/file/d/1XiE3wsYdQcsy011_5YF5qyo0AqWH1AzT/view?usp=sharing
Steps to Reproduce
- Go to https://phoenix-v2-a18z359ms.vercel.app
- Scroll a bit,
- Click on a link
Your Environment
- Grommet version:2.15.2
- Browser Name and version: Brave Version 1.16.76 Chromium: 86.0.4240.198 (Build officiel) (x86_64)
- Operating System and version (desktop or mobile): macOS Big Sur
This issue happens on all devices.
The grommet provider has full
property.
Current Workaround
If I disable the full
property, the issue is gone. But it breaks some of my layouts.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
react-router scroll to top on every transition - Stack Overflow
It works but it not handling back behaviour. I means when go back to previous page, previous page also load from the the...
Read more >How to Install Metal Grommets + Eyelets - Sew4Home
Using a sharp pair of small scissors, carefully cut out your opening. Err on the side of a bit small if not working...
Read more >Scroll Restoration - React Router v5
First, ScrollRestoration would scroll the window up on navigation. Second, it would use location.key to save the window scroll position and the scroll...
Read more >BFu - River Thames Conditions - Environment Agency - GOV.UK
#alexandria Gaznapiro, Chartis private client group contact, Tito cilapop mp3, ... Thalaivar rajinikanth facebook, Browning 22 pistol gold trigger, Side ...
Read more >Copeland Scroll™ Compressors for Refrigeration
2.1 Common information about Copeland Scroll™ compressors . ... ZF* compressors include a well in the top cap combined with a valve cap....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The solution proposed by @taysea resolve the initial issue. Thanks! However, it modifies the layout on some of my webpages (close to the behavior without
full
prop) but I can deal with that.It can also measure performance degradation. Before, the calculated layout was equal to the side of the screen (but it might be a part of the routing issue ?).
Now, it is the full page height.
Notice here this is a long page with an infinite scroll entirely unrolled.
This impacts First Contentful Paint and Largest Contentful Paint.
Here for the performance page of
/adn
.I noticed the HPE website also contains the element style on the
<Grommet/>
component. Is that a fix for the same issue? If this is the case, some documentation might be helping.I updated the link in the description with the modification.
Anyway, huge thanks to you for helping here! 🙏
Thanks for the follow up link @guillaumeLamanda. We are using NextJS + Grommet for the HPE Design system website, and we do not seeing this issue (https://design-system.hpe.design/). My inclination is to say that it is not a Grommet issue but something with the setup of the NextJS project. That being said, I will try to look into our project structure to see if there is anything we had to set up to make this scrolling work.
EDIT: A quick follow-up. Can you try adding
style={{ height: 'auto' }}
to your<Grommet>
component? This calculates the height of the Grommet container to the entire height of the content.