fix(compare): sticky school bar hidden behind the site header #44

Merged
tudor merged 1 commits from fix/schoolbar-sticky-offset into main 2026-07-15 12:02:30 +00:00
2 changed files with 22 additions and 2 deletions
+13
View File
@@ -227,6 +227,19 @@ test('compare chart on mobile shows school chips with tap-to-focus', async ({ pa
); );
expect(bodyOverflowsX).toBe(false); expect(bodyOverflowsX).toBe(false);
// The sticky school bar must pin *below* the sticky site header, not at
// top:0 where the header covers it and the selected schools are hidden.
// Assert the sticky offset directly (robust — no scroll timing needed).
const barTop = await page
.locator('[class*="schoolBar"]')
.first()
.evaluate((el) => parseFloat(getComputedStyle(el).top));
const headerHeight = await page
.locator('[class*="header"]')
.first()
.evaluate((el) => el.getBoundingClientRect().height);
expect(barTop).toBeGreaterThanOrEqual(headerHeight - 1);
// The trends chart still renders (inside the Explore trends section)… // The trends chart still renders (inside the Explore trends section)…
const chartCanvas = page.locator('canvas:visible').first(); const chartCanvas = page.locator('canvas:visible').first();
await expect(chartCanvas).toBeVisible({ timeout: 15_000 }); await expect(chartCanvas).toBeVisible({ timeout: 15_000 });
@@ -80,10 +80,12 @@
} }
/* Sticky school bar — column identity while scrolling; horizontal scroll on /* Sticky school bar — column identity while scrolling; horizontal scroll on
narrow screens */ narrow screens. Offset by the sticky site header's height (Navigation is
position: sticky, top: 0) so this bar pins just below it instead of
sliding underneath and being hidden. Header ≈ 65px desktop / 57px mobile. */
.schoolBar { .schoolBar {
position: sticky; position: sticky;
top: 0; top: 65px;
z-index: 10; z-index: 10;
background: var(--bg-primary, #faf7f2); background: var(--bg-primary, #faf7f2);
display: flex; display: flex;
@@ -173,6 +175,11 @@
pills with short names (matching the mobile mockup) instead of full-width pills with short names (matching the mobile mockup) instead of full-width
cards whose names wrap to several lines. */ cards whose names wrap to several lines. */
@media (max-width: 640px) { @media (max-width: 640px) {
/* The mobile Navigation header is shorter (≈57px). */
.schoolBar {
top: 57px;
}
.schoolChip { .schoolChip {
flex: 0 0 auto; flex: 0 0 auto;
min-width: 0; min-width: 0;