-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: improve perceived performance by initially loading an asset-les…
…s HTML file, `popup-init.html`, that then redirects to the slower `popup.html` Co-authored-by: Mark Stacey <markjstacey@gmail.com>
- Loading branch information
1 parent
de47c48
commit cd11ad3
Showing
5 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html dir="ltr"> | ||
<head> | ||
<meta http-equiv="refresh" content="0;url=/popup.html"> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | ||
<title>MetaMask</title> | ||
<style> | ||
/** | ||
* We try to match the user's system theme for the background color, but | ||
* since the actual popup will use the theme from the user's extension | ||
* settings we can't get it right 100% of the time. The browser doesn't | ||
* allow a height or width of 0, otherwise we wouldn't bother with the | ||
* background color. | ||
* Unfortunately (and conveniently?), if the user *does* have a | ||
* non-system theme set popup.html will flash the wrong theme, as the | ||
* loading screen itself always uses the system theme. So while this page | ||
* doesn't match popup.html's loading screen, the backgrounds will match, | ||
* so the redirect isn't all that jarring. | ||
* | ||
* Implementing https://github.com/MetaMask/metamask-extension/issues/26545 | ||
* would improve the situation. | ||
* | ||
* Porting the loading screen (inlining all assets and CSS) to this init | ||
* page may be a further UX improvement. | ||
*/ | ||
html { | ||
width: 357px; | ||
height: 600px; | ||
background: #f2f4f6; | ||
} | ||
@media screen and (prefers-color-scheme: dark) { | ||
html { | ||
background: #24272a; | ||
} | ||
} | ||
</style> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters