-
Notifications
You must be signed in to change notification settings - Fork 752
Fix: Flicker on page load #7007
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
Conversation
Summary of ChangesHello @dixita0607, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a visual bug where the website's theme would briefly flicker on page load, especially for users with dark mode enabled on their devices and the site configured for an 'automatic' theme. The solution involves reordering the execution of the theme-setting JavaScript to ensure it runs before the main content renders, thereby applying the correct theme immediately and preventing the temporary display of an incorrect theme. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses the theme flicker issue by strategically moving the theme-setting JavaScript snippet to an earlier position in the HTML structure. This change ensures that the theme is applied before the main page content loads, significantly improving the user experience on initial page render. The approach taken is sound for mitigating FOUC (Flash of Unstyled Content) related to theme changes.
- Move theme initialization script to right after the body tag is available - Apply stored theme synchronously before content renders - Fixes flash of light theme
6804d66 to
174afab
Compare
|
/gcbrun |
|
Visit the preview URL for this PR (updated for commit 174afab): https://dart-dev--pr7007-fix-blink-on-page-switch-jnbi6a2i.web.app |
parlough
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for improving this, looks good to me! I appreciate it :D
If you are interested, would you mind updating the Flutter docs website as well? We haven't started sharing this logic yet.
Sure. I can take that :) |
Fix for theme flash issue that we recently fixed on dart's website dart-lang/site-www#7007 **Before** https://github.com/user-attachments/assets/7629b755-fe7f-4f40-9664-e285ed336a23 **After** https://github.com/user-attachments/assets/db3b20f9-0cc7-4642-960b-e73de152383b
In some chromium based browsers, and mobile browsers, the theme flicker happens if the device theme is set to dark and landing on the website has 'automatic' theme setting.
Before
The flickering starts after 7s in the video.
https://github.com/user-attachments/assets/b2e1a2ec-e610-42de-9ab2-6f3c0a2123a4
About the Changes:
Moved the script that already handles the flash case before the main page contents is loaded.
After
https://github.com/user-attachments/assets/484ed6d1-5822-4fc8-ad2d-4beb3dd45ce8
Contribution guidelines:
dart format.<?code-excerptneed to be updated in their source.dartfile as well.