🐞 fix: Update footer color for chrome tinting and adjust related tests for iOS compatibility
This commit is contained in:
@@ -28,8 +28,10 @@
|
|||||||
* Colors:
|
* Colors:
|
||||||
* - HEADER_COLOR (#032F46) is the darker end of the .site-header
|
* - HEADER_COLOR (#032F46) is the darker end of the .site-header
|
||||||
* gradient.
|
* gradient.
|
||||||
* - FOOTER_COLOR (#102C45) is the sRGB equivalent of the
|
* - FOOTER_COLOR (#F26B53) is the orange of the .site-footer
|
||||||
* --color-cwc-blue-02 token used by .site-footer.
|
* `border-bottom` (the secondary color token, --color-cwc-orange-01).
|
||||||
|
* The home indicator area tints to this so the chrome matches
|
||||||
|
* the last visible color when the footer is in view.
|
||||||
*
|
*
|
||||||
* "In view" = any pixel of the element overlaps the viewport.
|
* "In view" = any pixel of the element overlaps the viewport.
|
||||||
*
|
*
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const HEADER_COLOR = '#032F46';
|
const HEADER_COLOR = '#032F46';
|
||||||
const FOOTER_COLOR = '#102C45';
|
const FOOTER_COLOR = '#F26B53';
|
||||||
const THEME_META_NAME = 'theme-color';
|
const THEME_META_NAME = 'theme-color';
|
||||||
|
|
||||||
function ensureThemeColorMeta() {
|
function ensureThemeColorMeta() {
|
||||||
|
|||||||
@@ -81,9 +81,11 @@ main#maincontent {
|
|||||||
* backgroundColor is updated at runtime by
|
* backgroundColor is updated at runtime by
|
||||||
* static/js/modules/ChromeTint.js.
|
* static/js/modules/ChromeTint.js.
|
||||||
*
|
*
|
||||||
* The elements have no background by default — they only become
|
* The elements are kept as small as possible (12px tall) so they
|
||||||
* opaque when the matching element (header / footer) is in view.
|
* stay well within the iOS safe-area insets and don't intrude into
|
||||||
* pointer-events: none ensures they never intercept clicks.
|
* the page content. They have no background by default — they only
|
||||||
|
* become opaque when the matching element (header / footer) is in
|
||||||
|
* view. pointer-events: none ensures they never intercept clicks.
|
||||||
*
|
*
|
||||||
* (iOS 26 ignores <meta name="theme-color">; this technique is
|
* (iOS 26 ignores <meta name="theme-color">; this technique is
|
||||||
* what replaced it.)
|
* what replaced it.)
|
||||||
@@ -96,9 +98,10 @@ main#maincontent {
|
|||||||
|
|
||||||
.chrome-tint--top {
|
.chrome-tint--top {
|
||||||
left: 0;
|
left: 0;
|
||||||
min-height: 15px;
|
min-height: 12px;
|
||||||
top: 4px;
|
top: 4px;
|
||||||
/* 4px from top + 15px tall = within the 4px-to-12px sampling window. */
|
/* 4px from top + 12px tall = within the 4px-to-12px iOS 26
|
||||||
|
sampling window for top status bar tinting. */
|
||||||
width: 90%;
|
width: 90%;
|
||||||
/* width: 90% > 80% iOS minimum for being sampled. */
|
/* width: 90% > 80% iOS minimum for being sampled. */
|
||||||
}
|
}
|
||||||
@@ -107,6 +110,6 @@ main#maincontent {
|
|||||||
bottom: 3px;
|
bottom: 3px;
|
||||||
/* 3px from bottom = within the 3px iOS sampling window. */
|
/* 3px from bottom = within the 3px iOS sampling window. */
|
||||||
left: 0;
|
left: 0;
|
||||||
min-height: 15px;
|
min-height: 12px;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import { expect, test } from "@playwright/test";
|
|||||||
const site = "http://community-works-collaborative.test/";
|
const site = "http://community-works-collaborative.test/";
|
||||||
|
|
||||||
const HEADER_COLOR = "#032F46";
|
const HEADER_COLOR = "#032F46";
|
||||||
const FOOTER_COLOR = "#102C45";
|
const FOOTER_COLOR = "#F26B53";
|
||||||
|
|
||||||
test.describe("chrome tint", () => {
|
test.describe("chrome tint", () => {
|
||||||
test.use({ viewport: { width: 402, height: 874 } });
|
test.use({ viewport: { width: 402, height: 874 } });
|
||||||
@@ -201,8 +201,8 @@ test.describe("chrome tint", () => {
|
|||||||
const el = document.querySelector(".chrome-tint--bottom");
|
const el = document.querySelector(".chrome-tint--bottom");
|
||||||
return el ? el.style.backgroundColor : "";
|
return el ? el.style.backgroundColor : "";
|
||||||
});
|
});
|
||||||
// #102C45 = rgb(16, 44, 69) (with sRGB rounding)
|
// #F26B53 = rgb(242, 107, 83) (no rounding)
|
||||||
expect(bg).toMatch(/^#?102[Cc]45$|^rgb\(\s*16,\s*4[34],\s*6[89]\s*\)$/);
|
expect(bg).toMatch(/^#?F26B53$|^rgb\(\s*242,\s*107,\s*83\s*\)$/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("bottom tint element clears when footer scrolls out of view", async ({
|
test("bottom tint element clears when footer scrolls out of view", async ({
|
||||||
@@ -254,7 +254,7 @@ test.describe("chrome tint", () => {
|
|||||||
document.querySelector(".chrome-tint--top").style.backgroundColor =
|
document.querySelector(".chrome-tint--top").style.backgroundColor =
|
||||||
"#032F46";
|
"#032F46";
|
||||||
document.querySelector(".chrome-tint--bottom").style.backgroundColor =
|
document.querySelector(".chrome-tint--bottom").style.backgroundColor =
|
||||||
"#102C45";
|
"#F26B53";
|
||||||
});
|
});
|
||||||
const data = await page.evaluate(() => ({
|
const data = await page.evaluate(() => ({
|
||||||
top: document.querySelector(".chrome-tint--top").style.backgroundColor,
|
top: document.querySelector(".chrome-tint--top").style.backgroundColor,
|
||||||
@@ -264,7 +264,7 @@ test.describe("chrome tint", () => {
|
|||||||
// share a value. iOS 26 should be able to sample each region
|
// share a value. iOS 26 should be able to sample each region
|
||||||
// independently.
|
// independently.
|
||||||
expect(data.top).toMatch(/^#?032[Ff]46$|^rgb\(\s*3,\s*4[67],\s*70\s*\)$/);
|
expect(data.top).toMatch(/^#?032[Ff]46$|^rgb\(\s*3,\s*4[67],\s*70\s*\)$/);
|
||||||
expect(data.bottom).toMatch(/^#?102[Cc]45$|^rgb\(\s*16,\s*4[34],\s*6[89]\s*\)$/);
|
expect(data.bottom).toMatch(/^#?F26B53$|^rgb\(\s*242,\s*107,\s*83\s*\)$/);
|
||||||
expect(data.top).not.toBe(data.bottom);
|
expect(data.top).not.toBe(data.bottom);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user