ethereum-org-website icon indicating copy to clipboard operation
ethereum-org-website copied to clipboard

Unexpected brief Flicker of Website Last Updated Text and Dark mode Icon on Page Load in 404 page

Open Codex-Bugmenot opened this issue 1 year ago • 11 comments

Describe the bug

When the 404 page loads after brief moment the website last updated text and the dark mode icon change(and the text ctrl +k in the search bar) .

To reproduce

  1. Go to an 404 page , i used "https://ethereum.org/en/1"
  2. Now click reload (keep an eye on either the website last updated text or dark mode sun/moon icon or the search bar)
  3. After a brief moment they change
  4. repeat step 2 again and again to see them change clearly

Expected behavior

1.Page should load with a single date format 2.Page should load with selected darkmode icon (either sun or moon)

Screenshots

1 2 3 4 5 6

Desktop (please complete the following information)

-Browser : Brave (Chromium build)

Smartphone (please complete the following information)

-Browser : Brave (Chromium build)

Additional context

observe that in the screen shots the date uses two different formats

month dd , year dd month year
( two different formats used)

Would you like to work on this issue?

  • [ ] Yes
  • [X] No

Codex-Bugmenot avatar Mar 19 '24 20:03 Codex-Bugmenot

Hey! Hmm, I'm not sure how this would be changed. I believe this happens on every page when you reload it. Cannot confirm for certain if that's the case for ethereum.org, but from my experience, what probably happens:

  1. pages are pre-generated during build, therefore the client is served HTML content
  2. Once loaded, the browser determines dark/light mode from browser prefer config or local storage
  3. Page updates icons (and maybe date) to correct option

This doesn't happen when you navigate through the page, because the navigation is taken care of by Next.js (no further calculations needed for dark mode/date format).

You can see the same on this page where ETH price is briefly in loading state after visit. Screenshot 2024-03-19 at 21 53 21

Maybe someone from core devs could advise, but I don't think this behaviour can be stopped as it executes after the page is loaded.

One possible option would be to hide the date/icon until it's determined to be the correct format/option.

Happy to help with this depending on the comments from core devs.

tomasgrusz avatar Mar 19 '24 20:03 tomasgrusz

The flicker for dark mode icon happens only if sun icon is the active one, if the moon is active there's no flicker for the icon.

Codex-Bugmenot avatar Mar 20 '24 15:03 Codex-Bugmenot

Can confirm I'm getting the same behavior. And yes, this is likely related to how pages are built on the server and then sent to the user before it knows some details like color mode... cc @pettinarip Do you know if this is a known Chakra or Next.js bug? Can think about how we could solve this.

@Codex-Bugmenot I see you checked no for wanting to work on this.. @tomasgrusz any chance you'd like to give it a shot?

wackerow avatar Mar 21 '24 18:03 wackerow

@tomasgrusz any chance you'd like to give it a shot?

Yeah, I can take a look at it. 👍

tomasgrusz avatar Mar 21 '24 23:03 tomasgrusz

@tomasgrusz i have found a website powered by "hashnode" which uses similar icons, want me to link it here?( it may be of help as a reference)

Codex-Bugmenot avatar Mar 21 '24 23:03 Codex-Bugmenot

This issue is stale because it has been open 30 days with no activity.

github-actions[bot] avatar May 09 '24 08:05 github-actions[bot]

Going to remove stale tag here as we still want this.

Is there any update @tomasgrusz? Any questions that you might have or need?

corwintines avatar Jun 11 '24 23:06 corwintines

Hi! Sorry I wasn't able to dedicate time to this the last few weeks. I have the capacity next week though, will take a look at it again.

Thanks for the wait. ✌🏻

tomasgrusz avatar Jun 13 '24 14:06 tomasgrusz

No problem @tomasgrusz, let us know if you need anything :)

corwintines avatar Jul 03 '24 00:07 corwintines

This issue is stale because it has been open 30 days with no activity.

github-actions[bot] avatar Aug 02 '24 08:08 github-actions[bot]

Hey @tomasgrusz :) thanks for working on this. any update here?

minimalsm avatar Aug 27 '24 16:08 minimalsm

Since the original post, several updates have occurred that affect how the color mode is handled on load, as well as how the 404 pages are handled.

I am no longer able to replicate this bug. Going to close this out for now, but others please flag/reopen if you're still getting this bug. Thanks!

wackerow avatar Sep 23 '24 16:09 wackerow

@all-contributors please add @Codex-Bugmenot for bugs

minimalsm avatar Sep 23 '24 16:09 minimalsm

@minimalsm

@Codex-Bugmenot already contributed before to bug

allcontributors[bot] avatar Sep 23 '24 16:09 allcontributors[bot]