Comments (4)
Thanks for the bug report. I've got a few questions to try to narrow down the cause:
- Is it FOUC (flash of unstyled content), where the page is white but just for a moment? Or is it persistent?
- If it's FOUC, is there anything that might be slowing down the initial page load? Are there some other extensions that load first? Is it a slow system and/or a slow HHD?
- If it's persistent, does the theme load properly when you refresh the page?
- Is it the light theme or the base styles without a theme?
- Does it only occur on the first new tab page or also when you reload the page and/or open more new tab pages?
I'm the same as you and prefer a dark theme. Anything white hurts the eyes when browsing at night! Especially sudden unexpected flashes.
It used to happen before where when loading the page it would flash white first before the theme was loaded. More recently I rewrote the theme loader to be synchronous and to load the theme before the page is actually rendered.
Under the hood, the way it currently works is there's a base set of styles that make up most of the CSS. These base styles are inline in the HTML so they will always load regardless. Then there are the themes which are small CSS that set some variables (CSS custom properties) and provide minor tweaks. The user's chosen theme (stored with the chrome.storage.local
API and defaults to light) is loaded into localStorage
when the theme is changed in the settings or when the extension is updated (via a background script). On a new tab page load we get the theme from localStorage
and inject it into a <style>
tag.
This theme loading strategy is a bit complex since a theme needs to be pre-loaded and then injected, but it does allow for a lot of power around theming. User customisable themes would be possible for example (it's not a feature now but something I'd like to add in future).
from new-tab.
- It is persistent among other tabs and when i close the browser.
- There is no page slowdown
- When I refresh the page the theme does not load properly and just stay on light theme while the settings clearly say dark theme.
- For now I can't clearly see the difference between light and without style.
- It persists across reloads, browser restarts or when i open up a new tab.
For now I will update to the latest git commit to see if the issue persists. Will close after 30 days if it's gone.
from new-tab.
Thank you for the info 🙂
I ran into what might be the same issue and fixed it in #1349. Although what you reported may be a different issue, since you mentioned the light theme is being loaded instead of your chosen theme (and not "no theme"). Closing the issue for now as there's a chance the bug is fixed, but please reopen if you encounter it again.
The bug I saw was in essence a race condition between the browser's HTML parser + DOM constructor, and inserting textContent
into the theme <style>
node. This extension omits all unnecessary tags in newtab.html
, so the browser adds any implicit standard HTML tags automatically. If that happened at exactly the same time as setting the style node textContent
, it inserted text into unexpected parts of the document, breaking the DOM and theme. This could cause page to load with "no theme".
The fix creates the a style node and inserts it in the DOM dynamically, which should prevent the race condition. The theme loader is a little larger but overall the performance is actually better!
from new-tab.
I'm reopening the issue as I've observed the same thing happening. My fix didn't work as expected.
from new-tab.
Related Issues (20)
- Open Tabs list reset on tabs events while a search is active
- Public release blockers HOT 2
- Chrome Web Store listing needs updating HOT 1
- Bookmark folders don't always look consistent
- Bookmark folder popups render off screen when too far to the right
- Bookmark folder popups don't show and hide at the correct time HOT 2
- Empty bookmark subfolders should have an "(empty)" entry HOT 1
- Too easy to open the wrong bookmark folder
- Bookmark folder popup position not always ideal HOT 5
- Dependency Dashboard
- Missing privacy policy HOT 2
- Change low resolution picture in the chrome webstore HOT 2
- [FEATURE] Add Unsplash Backgrounds HOT 2
- Move from jsdom to Happy DOM for faster tests HOT 1
- a question HOT 1
- Action Required: Fix Renovate Configuration
- Settings needs to be redesigned HOT 1
- Refactor the bookmark bar overflow functionality HOT 3
- Circular dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from new-tab.