-
-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(theme-color): dark address bar + no light-flash on dark-OS load (#7606) #7909
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1bb54a7
fix(theme-color): emit media-scoped dark variant for iOS Safari (#7606)
JohnMcLear 0975c41
fix(theme-color): prevent the light-mode flash on dark-OS load (#7606)
JohnMcLear 90008f2
docs(changelog): note the dark-mode address-bar + flash fix (#7606)
JohnMcLear 6f7b07b
fix(theme-color): guard pre-paint script on #skinvariantsbuilder; ign…
JohnMcLear File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -5,6 +5,9 @@ | |
| && req.acceptsLanguages(Object.keys(langs))) || 'en'; | ||
| var renderDir = (langs[renderLang] && langs[renderLang].direction === 'rtl') ? 'rtl' : 'ltr'; | ||
| var themeColor = skinColors.configuredToolbarColor(settings.skinName, settings.skinVariants); | ||
| // See pad.html: emit a media-scoped dark variant so iOS Safari picks the | ||
| // dark toolbar color at first paint on a dark-OS client (issue #7606). | ||
| var darkThemeColor = settings.enableDarkMode ? skinColors.darkToolbarColor(settings.skinName) : null; | ||
| %> | ||
| <!doctype html> | ||
| <html lang="<%=renderLang%>" dir="<%=renderDir%>" translate="no" class="pad <%=settings.skinVariants%>"> | ||
|
|
@@ -39,8 +42,30 @@ | |
| <meta name="robots" content="noindex, nofollow"> | ||
| <meta name="referrer" content="no-referrer"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> | ||
| <% if (themeColor) { %><meta name="theme-color" content="<%=themeColor%>"><% } %> | ||
| <% if (themeColor) { %><meta name="theme-color" content="<%=themeColor%>"<% if (darkThemeColor) { %> media="(prefers-color-scheme: light)"<% } %>><% } %> | ||
| <% if (darkThemeColor) { %><meta name="theme-color" content="<%=darkThemeColor%>" media="(prefers-color-scheme: dark)"><% } %> | ||
| <link rel="shortcut icon" href="../../favicon.ico"> | ||
| <% if (darkThemeColor) { %> | ||
| <script> | ||
| // See pad.html: apply the dark skin classes before the stylesheet paints | ||
| // so dark-OS users don't see a white flash on load (issue #7606). | ||
| (function () { | ||
| try { | ||
| if (window.location.hash.toLowerCase() === '#skinvariantsbuilder') return; | ||
| if (localStorage.getItem('ep_darkMode') === 'false') return; | ||
| if (!(window.matchMedia && | ||
| window.matchMedia('(prefers-color-scheme: dark)').matches)) return; | ||
| var el = document.documentElement; | ||
|
Comment on lines
+53
to
+58
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 6f7b07b alongside pad.html — same |
||
| ['super-light', 'light', 'dark', 'super-dark'].forEach(function (c) { | ||
| ['editor', 'background', 'toolbar'].forEach(function (k) { | ||
| el.classList.remove(c + '-' + k); | ||
| }); | ||
| }); | ||
| el.classList.add('super-dark-editor', 'dark-background', 'super-dark-toolbar'); | ||
| } catch (e) { /* localStorage/matchMedia unavailable — fall back to light */ } | ||
| })(); | ||
| </script> | ||
| <% } %> | ||
| <% e.begin_block("timesliderStyles"); %> | ||
| <link rel="stylesheet" href="../../static/css/pad.css?v=<%=settings.randomVersionString%>"> | ||
| <link rel="stylesheet" href="../../static/css/iframe_editor.css?v=<%=settings.randomVersionString%>"> | ||
|
|
||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Good catch — fixed in 6f7b07b. Added the
#skinvariantsbuilderguard to the pre-paint script in both pad.html and timeslider.html so it matches pad.ts's auto-switch condition exactly, plus a backend assertion to prevent regression.