question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grommet break the scroll to top on client side routing

See original GitHub issue

The 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

  1. Go to https://phoenix-v2-a18z359ms.vercel.app
  2. Scroll a bit,
  3. 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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
guillaumeLamandacommented, Nov 21, 2020

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 ?).

image

Now, it is the full page height.

image 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! 🙏

2reactions
tayseacommented, Nov 19, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found