Merge pull request 'fix(compare): align sticky school chips with their data columns on desktop' (#51) from fix/compare-final-review-mustfix into main
Stage (build -> staging -> E2E gate) / Build Backend (FastAPI) (push) Successful in 14s
Stage (build -> staging -> E2E gate) / Build Frontend (Next.js) (push) Successful in 53s
Stage (build -> staging -> E2E gate) / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 13s
Stage (build -> staging -> E2E gate) / Deploy to Staging (push) Successful in 1s
Stage (build -> staging -> E2E gate) / E2E Journeys against Staging (push) Failing after 40s

Reviewed-on: #51
This commit was merged in pull request #51.
This commit is contained in:
2026-07-16 20:10:45 +00:00
3 changed files with 38 additions and 3 deletions
+8
View File
@@ -197,6 +197,14 @@ test('comparing two schools shows the parent-first sections side by side', async
// Every number gets an anchor: at least one England-average tick or label
await expect(page.getByText(/England \d+/).first()).toBeVisible();
// Desktop: the sticky school bar shares the sections' grid template
// (200px label rail + one column per school) so chips align with the
// columns they label.
const barTemplate = await page
.locator('[aria-label="Schools in this comparison"]')
.evaluate((el) => getComputedStyle(el).gridTemplateColumns);
expect(barTemplate).toMatch(/^200px /);
// Ofsted linkout goes to the school's provider page, never a report deep-link
const ofstedLink = page.getByRole('link', { name: /Ofsted page/i }).first();
await expect(ofstedLink).toBeVisible();
@@ -148,6 +148,27 @@
text-overflow: ellipsis;
}
/* Desktop (matches the sections' 761px breakpoint): the bar adopts the same
grid template as compareSections' .grid — a 200px row-label rail plus one
column per school — so each chip sits exactly over the column it labels.
The first chip starts after the empty label rail. */
@media (min-width: 761px) {
.schoolBar {
display: grid;
grid-template-columns: 200px repeat(var(--school-count, 3), 1fr);
gap: 0 0.75rem;
overflow-x: visible;
}
.schoolChip {
min-width: 0;
}
.schoolChip:first-child {
grid-column: 2;
}
}
.chipRemove {
margin-left: auto;
border: none;
+9 -3
View File
@@ -9,7 +9,7 @@
'use client';
import { useEffect, useRef, useState } from 'react';
import { useEffect, useRef, useState, type CSSProperties } from 'react';
import { useRouter, usePathname, useSearchParams } from 'next/navigation';
import { useComparison } from '@/hooks/useComparison';
@@ -342,8 +342,14 @@ export function ComparisonView({
/>
) : (
<>
{/* Sticky school bar — column identity while scrolling */}
<div className={styles.schoolBar} aria-label="Schools in this comparison">
{/* Sticky school bar — column identity while scrolling. On desktop
it shares the sections' grid template (via --school-count) so
each chip sits exactly over the column it labels. */}
<div
className={styles.schoolBar}
style={{ '--school-count': activeSchools.length } as CSSProperties}
aria-label="Schools in this comparison"
>
{activeSchools.map((school, index) => (
<div
key={school.urn}