Skip to content

Window the News pager and collapse it on mobile (#1486) - #1504

Merged
jonfroehlich merged 8 commits into
masterfrom
1486-news-windowed-pager
Dec 5, 2026
Merged

jonfroehlich merged 8 commits into
masterfrom
1486-news-windowed-pager

Conversation

@jonfroehlich

@jonfroehlich jonfroehlich commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

Closes #1486

Summary

The News pager linked every page, so with ~28 pages it was wider than the container: it scrolled sideways at every width below about 1305 to 1307px (depending on the browser build), and at 1280px the left end was clipped. It now shows a window of pages, and on narrow screens it collapses to three controls.

  • Above 768px: Newer, page 1, the current page ±2, the last page, Older, with ellipses between. That is at most 11 controls for any page count. Six pages or fewer are listed in full.
  • 768px and below: Newer / "Page N of M" / Older on a three-column grid. Older stays in place on page 1, where there is no Newer.
  • Targets: every pager control is at least 44×44 CSS px at all widths (they were 36px).
  • Screen readers: the current item reads "Page N of M" (one sr-only string) along with aria-current="page", replacing "(current page)". Ellipses are aria-hidden spans, never links. The landmark, its label and the link names are unchanged.

What changed, by file:

  • website/views/news_listing.py: Paginator.get_page() replaces the try/except, with the same ?page= fallbacks (pinned by a test). Adds NEWS_ITEMS_PER_PAGE = 12 and a page_range context variable built with get_elided_page_range(on_each_side=2, on_ends=1).
  • website/templates/website/news_listing.html: the pagination block only.
  • website/static/website/css/news-listing.css: the PAGINATION section. It adds flex-wrap as a safety net, resets Bootstrap 3's float/margin-left: -1px, and adds one max-width: 768px block for the compact form. Line endings stay CRLF, as in the file before.
  • website/views/news_item.py: removes the unused Paginator, EmptyPage, PageNotAnInteger import.
  • website/management/commands/seed_demo_news.py + .pa11yci.ci.json: see decision 6.
  • Tests: website/tests/test_news_pagination.py (server) and website/tests/test_news_pagination_e2e.py (Playwright). The new e2e module is added to the e2e job's module list in .github/workflows/test.yml.

No model change, no new dependency, no JS, no version bump.

Decisions taken on provisional defaults (Jon to confirm)

These are the plan's defaults (plan comment). Each is provisional:

  1. Jump-by-year: out, left for a follow-up issue.
  2. <link rel="prev/next">: out.
  3. 44px targets at all widths, so the desktop pager buttons grow from 36 to 44px. WCAG 2.0 AA does not require this; it is a look change. The alternative is 44px in compact mode only.
  4. Mobile form: Newer / "Page N of M" / Older, with no first/last jump. The first and last numbers do not fit at 320px with 44px targets.
  5. Screen-reader text: "(current page)" dropped in favour of aria-current plus "Page N of M".
  6. CI seed: yes. seed_demo_news now makes 121 demo items (the three named ones plus 118 short, authorless fillers dated before them), giving 11 pages, and the CI Pa11y config adds /news/?page=6 (two ellipses) and /news/?page=11 (last page). The three named items stay newest. Cost: the home and news-detail scans show more news cards than before (their recent-news lists now fill up), so their CI counts are not directly comparable to master's.

Failing tests first

The tests were committed first, in 9806c56, and run against the pre-change code (Python 3.13, makeabilitylabwebsite-website image plus a throwaway layer with Playwright 1.65.3 and Chromium).

Server tests (website.tests.test_news_pagination), pre-change: 7 fail, and the 5 pins pass.

test_first_page_elides (…NewsPagerSevenPagesTests) ... FAIL
test_no_pager (…NewsPagerSinglePageTests) ... ok
test_all_pages_listed (…NewsPagerSixPagesTests) ... ok
test_bad_page_parameters_fall_back (…NewsPagerWindowTests) ... ok
test_current_item_names_page_and_total (…NewsPagerWindowTests) ... FAIL
test_first_page (…NewsPagerWindowTests) ... FAIL
test_landmark_and_single_current (…NewsPagerWindowTests) ... ok
test_last_page (…NewsPagerWindowTests) ... FAIL
test_middle_page_has_two_hidden_ellipses (…NewsPagerWindowTests) ... FAIL
test_middle_page_is_bounded (…NewsPagerWindowTests) ... FAIL
test_middle_page_window (…NewsPagerWindowTests) ... FAIL
test_query_count (…NewsPagerWindowTests) ... ok
Ran 12 tests
FAILED (failures=7)

For example, test_middle_page_is_bounded fails with AssertionError: 40 not less than or equal to 9. The query-count pin (3 queries) was read off the pre-change code and is unchanged afterwards.

Browser tests (website.tests.test_news_pagination_e2e), pre-change: all 20 width×page subtests fail. Examples:

AssertionError: 1307 not less than or equal to 1280 : horizontal scroll at 1280px, page 5: scrollWidth 1307
AssertionError: 36 not greater than or equal to 44 : '2' is 36.0px wide at 1280px, page 1
AssertionError: 1021 not less than or equal to 769 : horizontal scroll at 769px, page 28: scrollWidth 1021
Ran 2 tests … FAILED (failures=20)

After the change, both modules pass locally. At the current head (fc32521) that is 18 tests: 14 server tests and 4 e2e tests. Full local suite at fc32521, with Playwright and Chromium installed: 1280 tests, 6 skipped, 2 failures. Both failures happen identically on unmodified master in the same image, because the local image's packages are older than the pins: test_news_prose_editor.test_cleaner_kwargs_match_snapshot (the image has django-prose-editor 0.26.0, the pin is 0.30.0) and test_pa11y_ci_config.test_hide_elements_includes_installed_toolbar_host (the image has django-debug-toolbar 5.0.1, the pin is 8.0.0). CI installs the pins.

Reflow measurements

These come from a scratch site with 330 news items (28 pages), Puppeteer's headless Chrome, with the debug toolbar hidden. scrollWidth is shown against the viewport width. Correction (review 1): Playwright's Chromium, which the e2e tests use, gives "before" values 2 to 3px higher (for example 1307 at 1280px, as in the e2e excerpt above, against 1305 here). The "after" values are the same in both.

Width Before, page 1 / 14 / 28 After, page 1 / 14 / 28 Visible controls after
1280 1280 / 1305 / 1280 (list overflows the container; left end clipped) 1280 / 1280 / 1280 6 / 11 / 6
768 1014 / 1049 / 1018 768 / 768 / 768 2 / 3 / 2
375 818 / 852 / 821 375 / 375 / 375 2 / 3 / 2
320 790 / 825 / 794 320 / 320 / 320 2 / 3 / 2

Control sizes after: page links 44×44, Newer 66×44, Older 59×44, and "Page 14 of 28" 113×44 in compact mode. The e2e test checks the same conditions at 320, 375, 768, 769 and 1280px on pages 1, 5, 14 and 28.

Pa11y (WCAG2AA, axe + htmlcs)

Local, same scratch site, before and after:

URL Before After
/news/ 44 16
/news/?page=2 45 16
/news/?page=14 45 16
/news/?page=28 44 16
/news/?page=14 at 320×700 20 2

Before, 114 of the errors on the four desktop URLs (28 + 29 + 29 + 28), plus 18 at 320px, were colour-contrast findings on the pager's own links. Correction (review 1): an earlier version of this said 103, because my grep missed selectors that wrap onto a second line (#makelab-news > nav > ul > li > a). After, there are none. All of the remaining errors are the footer's existing contrast findings, which are identical before and after. No new finding appears.

CI (run 47546655906 on 1963d79, read from the full a11y job log; master baseline is run 47540051052 on a643f99):

URL master this PR
/ 56 60
/people/ 17 17
/publications/ 25 25
/projects/ 20 20
/news/ 16 16
/news/?page=6 (new, two ellipses) — 16
/news/?page=11 (new, last page) — 16
/awards/ 22 22
/project/demo-active-tall/ 53 53
/member/demolovelace/ 25 25
/news/demo-news-one/ 26 28

There are no findings on the pager (#makelab-news > nav) on any URL. The latest run, 47556927844 on fc32521, gives the same counts for every URL above. It also scans /project/demo-ended-tall/ (23 errors), a URL that came in from master's #1501 and is not part of this change. The two increases come from the larger seed (decision 6), not from new kinds of error. On /, the same contrast finding that already appears on each home-page news item (two per item) now shows on two more items: 6 → 10 findings, +4. On /news/demo-news-one/, the recent-news sidebar shows 3 items instead of 2, and its two existing contrast findings repeat once more (+2). Every other count matches master.

Review 1 follow-up

Review 1:

  • In compact mode the label now wraps rather than sliding under Newer and Older when the default font is larger.
  • New tests pin the compact layout, the Newer and Older targets and names, and the seed-to-Pa11y link.
  • The seed count is derived from NEWS_ITEMS_PER_PAGE.

The per-finding answers are in the PR conversation.

Screenshots

Before and after, middle page (?page=14 of 28) with the pager in view, at 1280, 768, 375 and 320px. Jon will attach them.

What ran where

  • Django suite: locally in the Python 3.13 image (isolated Postgres 16), and in CI's test job.
  • E2E module: locally, in a throwaway image built from the Python 3.13 site image with Playwright 1.65.3 and Chromium added, and in CI's e2e job (report-only). At fc32521 (run 47556927844), its log shows all four test_news_pagination_e2e tests ran and passed (... ok, none skipped), within Ran 32 tests ... OK. CI's test job: Ran 1248 tests ... OK (skipped=6). The module now uses the shared PlaywrightLiveServerTestCase from website/tests/e2e_base.py (Share one Playwright lifecycle across e2e tests; stop the driver when launch fails (#1489) #1503, merged into this branch).
  • Local note: the local image has django-debug-toolbar 5.0.1, while master pins 8.0.0. That version gap is the reason test_pa11y_ci_config fails locally, on master as well.

🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5

jonfroehlich and others added 3 commits December 5, 2026 09:00
Server tests pin the elided page range, the hidden ellipses and the
"Page N of M" screen-reader text, plus the existing ?page= fallbacks and
query count. The Playwright module checks for no sideways scroll from
320 to 1280px, the compact mobile form and 44px targets, and is added to
the e2e job. On the current code 7 server tests and all 20 browser
subtests fail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY
The listing linked every page, so with ~28 pages the pager was wider than
the container and scrolled sideways on every screen. It now renders
Django's elided range (first, current +/- 2, last, with aria-hidden
ellipses), at most 11 controls. At 768px and below CSS hides the numbers
and shows "Newer / Page N of M / Older" on a three-column grid. Pager
targets grow from 36 to 44px, and the current item's screen-reader text
becomes "Page N of M" in place of "(current page)".

The view switches to Paginator.get_page (same ?page= fallbacks) and
names the page size. news_item.py drops an unused paginator import.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY
seed_demo_news adds 118 short, authorless fillers dated before the three
named items, giving 11 pages, the smallest count where a middle page
shows both ellipses. The CI Pa11y config scans /news/?page=6 and
/news/?page=11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY

@jonfroehlich jonfroehlich left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review 1 — head 1963d79

No blocking findings. The change does what the PR says and matches the agreed plan. Two should-fix items and four nits below. Comment only; decisions 1 to 6 remain Jon's.

What ran where

  • Django suite and new modules: Python 3.13.1 / Django 5.2.19 in the local site image, isolated Postgres 16.
  • Browser tests and probes: a throwaway image built from that one with Playwright 1.65.3 and Chromium.
  • Pa11y: pa11y-ci (axe + htmlcs, WCAG2AA) with Chrome 143 against a 330-item scratch site, base and head.
  • CI run 47546655906 is on this head; I read all three job logs rather than the ticks.

Claims re-derived

Claim Result
12 server + 2 e2e tests pass Confirmed locally and in CI
On 9806c56: 7 server failures, 5 pins pass, 20 e2e subtests fail Confirmed, with the same example messages
Query-count pin of 3 is unchanged Confirmed: passes before and after
Full suite: 1231 tests, 2 failures Confirmed. Both failures also fail on master a643f99 in the same image (older django-prose-editor and django-debug-toolbar than the pins)
CI test: 1231 OK (master: 1217). e2e: 30 OK, both new tests ran, none skipped
After: no horizontal scroll at 1280 / 768 / 375 / 320 Confirmed, and also at 767, 769, 800 and 992, on pages 1, 2, 5, 6, 14, 27 and 28
Visible controls 6 / 11 / 6 wide and 2 / 3 / 2 compact Confirmed
Sizes 44×44, Newer 66×44, Older 59×44, "Page 14 of 28" 113×44 Confirmed
Local Pa11y 44 / 45 / 45 / 44 before and 16 after; at 320px, 20 before and 2 after Confirmed exactly
CI Pa11y table Confirmed from the log. No finding mentions the pager; the home page's +4 and the detail page's +2 are extra demo news cards with existing contrast patterns
CRLF kept in news-listing.css Confirmed: every line

Also clean:

  • Seed: idempotent on a second run; 121 items, 11 pages; ?page=6 has two ellipses and ?page=11 one; the three named items stay newest.
  • Bootstrap 3: computed float: none and margin-left: 0, no box overlap, compact current item transparent, hovering an ellipsis leaves it transparent.
  • 768px boundary: compact at 767 and 768, windowed at 769; one max-width query, so no gap.
  • Accessibility tree (Chromium): one aria-current, the current item reads "Page 14 of 28", ellipses are absent, and compact mode leaves two focusable links.

Findings

1. should-fix: the compact pager overlaps itself at larger default font sizes. Reproduced.

  • The pager's sizes are in rem and the label is white-space: nowrap in an auto grid column. When the root font grows, the two minmax(0, 1fr) columns shrink to nothing and the label slides under Newer and Older. There is no horizontal scroll, so the e2e test does not see it.
  • Reproduction: /news/?page=14 of 28 at 320px with html { font-size: 24px }. Newer spans 15 to 113px, the label 76.5 to 243.5, Older 218 to 305; the text collides. Same at 360 and 375px, and at 32px.
  • At 20px (the size test_project_listing_e2e already treats as supported) the boxes overlap by 10.5px at 320px, but padding hides it.
  • Not blocking: WCAG 1.4.4 can still be met through browser zoom.
  • Candidate fix, checked at 20, 24 and 32px on 320 to 375px with the PR's e2e module still passing: grid-template-columns: minmax(min-content, 1fr) minmax(0, auto) minmax(min-content, 1fr), and text-align: center in place of white-space: nowrap, so the label wraps.
  • Three-digit page counts are fine: "Page 100 of 100" at 16px and 320px does not overlap.

2. should-fix: the compact layout and some stated behaviours are not pinned by any test.
I ran 38 single-change mutants against both new modules; 26 were killed and 12 survived. The survivors that matter:

  • Deleting display: grid from the compact block, or grid-column: 2, or grid-column: 3; justify-self: end, or width: 100%. "Older stays in place on page 1" is therefore untested. One e2e assertion comparing Older's right edge on pages 1 and 14, plus the label's centre, would cover it.
  • Deleting the Newer or the Older aria-label (the PR says link names are unchanged).
  • Pointing Newer's href at ?page=1. Older's target is caught only incidentally, by the 6-page test.
  • Lower value: removing flex-wrap, the float/margin-left reset, the compact plain-text rule or nowrap.

3. nit: PR body details.

  • "103" pager contrast findings before: I count 114 across the four desktop URLs (0 after).
  • The "before" scrollWidth values are 2 to 3px below what Playwright's Chromium gives (1307, as the body's own e2e excerpt says, against 1305 in the table).
  • Screenshots are not attached yet.

4. nit: the seed's 11 pages are not tied to the page size or tested. _TOTAL = 121 is a literal, nothing runs seed_demo_news in a test, and get_page falls back silently to the last page. If the count or page size drifts, ?page=6 and ?page=11 in .pa11yci.ci.json would scan a different pager state with no failure.

5. nit: e2e failure messages. The target text comes from innerText, which includes the sr-only string, so the current item prints as "Page 14 of 28\n14".

6. nit: Playwright driver not stopped when the browser fails to launch (from the second review, below). Pre-existing pattern shared by all four e2e modules; worth one cleanup across them.

For decision 4, not a defect: with no first/last jump in compact mode, reaching the oldest page on a phone takes 27 taps at about 28 pages.

Not verified

  • Real screen-reader output (VoiceOver, NVDA).
  • Fractional viewport widths under browser zoom; reasoned from the single media query.
  • The candidate fix for finding 1 at compact widths above 375px.
  • CI's Pa11y scans at 1280px only, so the compact form is scanned locally, not in CI (as the plan agreed).

Second review: Gemini 4 Neon (xhigh) (gemini-4-neon-xhigh)

Six findings, each triaged by running it. Totals: 1 confirmed, 3 partly valid, 2 rejected. The script excluded no files from the diff it sent.

# Finding Verdict Reason
1 seed_demo_news.py: the filler loop is not covered by the cleanup, so a re-run duplicates rows or raises Rejected (withdrawn by Gemini) The unchanged cleanup deletes by title__startswith="Demo News", which covers the fillers. Two runs in a row gave the same 121 items and 11 pages with no error
2 test_news_pagination_e2e.py: setUpClass does not stop Playwright if chromium.launch() raises, so later e2e classes fail Partly valid, nit The leak is real. With Playwright installed and Chromium missing, later classes skip (their own guard catches the error) and do not fail; the run exits 0 and database tests after it pass. Same code is in the three existing e2e modules
3 test_news_pagination_e2e.py: tearDownClass skips _pw.stop() if browser.close() raises Partly valid, nit, not reproduced True by reading; needs a browser crash. Same code is on master in the other e2e modules
4 test_news_pagination_e2e.py: DJANGO_ALLOW_ASYNC_UNSAFE is set at import time Rejected as a change in behaviour The same line is already in the three existing e2e modules, so test discovery sets it today
5 news-listing.css: minmax(0, 1fr) side tracks let Newer and Older collide with the label Confirmed, should-fix My finding 1. Reproduced for larger text; its three-digit-page case at 16px does not overlap
6 PER_PAGE = 12 and other page-size literals do not import NEWS_ITEMS_PER_PAGE Partly valid, nit The test literal is deliberate (it keeps the module importable on the pre-change code) and would fail loudly, not silently. The _TOTAL = 121 part is valid: my finding 4

Follow-up. I sent rebuttals on findings 1 and 2.

  • Finding 1: Gemini withdrew it; its scenario assumed lines it had not seen.
  • Finding 2: Gemini agreed that later classes skip, not fail, and that this is a low-severity cleanup across all four e2e modules, not a blocker here. It added two hypothetical cases where the leaked event loop would cause failures: a later async test in the same process, or scoping DJANGO_ALLOW_ASYNC_UNSAFE to the class. I have not verified either; neither applies to the suite as it is.
  • Nothing remains disputed.

🤖 Generated with Claude Code — review, triage and verdicts by Fable 5.2, claude-fable-5-2; second-review findings by gemini-4-neon-xhigh via Google Antigravity CLI

jonfroehlich and others added 2 commits December 5, 2026 09:38
Review 1 on #1504 found that the compact pager overlaps itself when the
browser's default font is larger, and that several layout promises were
untested. New e2e checks: no overlap between Newer, the label and Older at
20, 24 and 32px root fonts; Newer at the left edge, the label centred and
Older at the right edge on every page; the current page as plain text in
compact mode; the full 4px gap between windowed boxes. New server checks:
Newer/Older targets and names, and that seed_demo_news gives the pager
states .pa11yci.ci.json scans. The larger-text test fails on the current
CSS (13 subtests). E2e failure messages now name the current item by its
visible label, and the driver is stopped if launching or closing the
browser fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY
With a larger browser default font the side grid columns shrank to
nothing and the nowrap "Page N of M" label slid under Newer and Older.
The side columns now never go below their links' min-content, and the
label centres and wraps in the middle column (the fix suggested in
review 1 on #1504). The larger-text e2e test skips one case that cannot
fit on one row at all (32px root font, 320px, middle page: the two links
and gaps alone are 294px against a 290px pager), and the compact test
now checks that Newer and Older keep their own width.

seed_demo_news derives its item count from NEWS_ITEMS_PER_PAGE and a
page count, so the pages .pa11yci.ci.json scans follow the page size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY
@jonfroehlich

Copy link
Copy Markdown
Member Author

Fix round 1: answers to review 1

New head: e8cbf3d. Commits:

CI run 47549926782 on e8cbf3d:

  • test: success, 1235 OK, 32 skipped.
  • e2e: success, 32 OK. All four test_news_pagination_e2e tests ran and passed, none skipped.
  • a11y: success. Per-URL counts are identical to the previous run, and none of the findings are on the pager.

Locally (Python 3.13 image): the two new modules pass. The full suite is 1235 tests with 2 failures. Those are the same two pre-existing image-version failures that also fail on master: test_cleaner_kwargs_match_snapshot and test_hide_elements_includes_installed_toolbar_host.

Fable 5.2 findings

1. Compact pager overlaps at larger default fonts. Fixed in e8cbf3d, with the test in a6ccad8.

  • Reproduced first. A new e2e test, test_compact_pager_does_not_overlap_with_larger_text, checks root fonts of 20, 24 and 32px at 320 and 375px on pages 1, 14 and 28. On 1963d79, 13 of its 18 subtests failed.
  • The fix is your candidate: minmax(min-content, 1fr) minmax(0, auto) minmax(min-content, 1fr), with text-align: center in place of nowrap. CRLF is kept.
  • One disagreement, with evidence. The test leaves out one case: a 32px root font at 320px on a middle page. Even with the fix, that case still overlaps, because nothing can fit on one row. Measured: Newer is 130px, Older is 116px, and the two --space-3 gaps are 24px each. That is 294px before the label, against a 290px pager (Older ends at 307, the label at 224, Older starts at 191). Your note said the fix was checked at 32px from 320 to 375px; at 320px on page 14 my run disagrees. Every other combination passes, including 32px at 375px and 32px at 320px on pages 1 and 28. Fixing that last cell would need a different layout, such as stacking the label on its own row. That is a design call, so I have left it alone.

2. Compact layout and stated behaviours not pinned. Fixed in a6ccad8 and e8cbf3d. New tests:

  • Compact geometry (e2e, at 320 and 768px, pages 1/5/14/28): Newer is flush left, the label is centred, Older is flush right on every page (so it also holds on page 1), each link is under 80px wide (no stretching across its column), and the current item's background is transparent.
  • Windowed (e2e): every gap between boxes is at least 4px, which pins the Bootstrap margin-left reset.
  • Server: an exact href and aria-label check for Newer (page 19) and Older (page 21) on page 20.

Mutation check against both modules: I applied each change below on its own and ran the two modules. All of them now fail:

  • deleting display: grid, grid-column: 2, grid-column: 3; justify-self: end, justify-self: end alone, justify-self: start, width: 100% or the margin-left: 0 reset;
  • deleting the compact plain-text colours;
  • reverting to the old grid columns;
  • pointing Newer's href at ?page=1;
  • deleting the Newer or the Older aria-label;
  • dropping the seed by one item.

One mutant survives, and it is equivalent: deleting only grid-column: 3. Grid auto-placement puts Older in column 3 anyway, after the current item in column 2, on page 1 as well.

Declined, as low value:

  • flex-wrap: it is a safety net. With at most 11 controls the windowed row never reaches the container edge (about 564px against 720px or more), so no test can make it wrap without changing the markup.
  • nowrap: it is gone, replaced by text-align: center.

3. PR body details. Fixed (body patched).

  • 103 → 114: you are right. My grep missed selectors that wrap onto a second line. Per URL, before minus after is 28 + 29 + 29 + 28 = 114 on the four desktop URLs, plus 18 at 320px.
  • Before scrollWidth: the reflow table now says it was measured in Puppeteer's Chrome, and that Playwright's Chromium gives values 2 to 3px higher (1307 against 1305). The after values are the same in both.
  • Screenshots: still listed for Jon to attach.

4. Seed not tied to the page size or tested. Fixed in e8cbf3d.

  • seed_demo_news now uses _PAGES = 11 and computes NEWS_ITEMS_PER_PAGE * (_PAGES - 1) + 1 items.
  • A new SeedDemoNewsPagerTests runs the command and reads the news URLs from .pa11yci.ci.json, which must be exactly ?page=6 and ?page=11. It asserts that page 6 has two ellipses and that page 11 is the real last page of 11. The off-by-one seed mutant fails it.

5. E2e failure messages include the sr-only text. Fixed in a6ccad8. The current item is now reported by the text of its .news-pagination-label.

6. Playwright driver not stopped when launch fails. Fixed in this module only (a6ccad8).

  • If launch fails, setUpClass now stops the driver.
  • tearDownClass stops it in a finally block after closing the browser, which also covers Gemini's finding 3.
  • The other three e2e modules have the same pattern. I left them unchanged to keep this PR to the News pager; it suits a small separate cleanup.

Decision 4 note (27 taps to the oldest page on a phone): no change. This is a call for Jon, not a defect.

Gemini findings

  1. Seed cleanup does not cover the fillers. Agree with the rejection. The cleanup deletes by title__startswith="Demo News", and two runs in a row give 121 items with no error.
  2. Driver leak on launch failure. Fixed in this module (see 6).
  3. tearDownClass skips _pw.stop() if close() raises. Fixed in this module (see 6).
  4. DJANGO_ALLOW_ASYNC_UNSAFE set at import time. Agree with the rejection. It is the existing pattern in all three e2e modules, and test discovery already sets it.
  5. minmax(0, 1fr) collision. Fixed (see 1), apart from the 32px/320px case.
  6. Page-size literals. Agree: partly valid.
    • The test's PER_PAGE = 12 literal stays on purpose. It lets the module import on the pre-change code, which the failing-first evidence needed, and a drift there makes tests fail loudly rather than silently.
    • The seed part is fixed (see 4).

🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5

@jonfroehlich jonfroehlich left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review 2 — head e8cbf3d, range 1963d79..e8cbf3d

No blocking findings. Every review 1 finding is closed or reasonably declined, the fixes broke nothing, and default-size rendering is unchanged. One should-fix (a test gap), three nits, and one design question for Jon. Comment only.

What ran where

  • Full suite, this head, local site image (Python 3.13), isolated Postgres 16: 1235 tests, 2 failures, 38 skipped. The two failures are test_cleaner_kwargs_match_snapshot and test_hide_elements_includes_installed_toolbar_host; I re-ran both on base a643f99 in the same image and interpreter and they fail there too (the image's packages are older than the pins).
  • All four e2e modules, this head, a throwaway image built from that one with Playwright 1.65.3 and Chromium: 32 tests OK, none skipped.
  • CI run 47549926782 on this head: test 1235 OK (skipped=32), e2e 32 OK, a11y success.
  • Missing browser (Playwright installed, Chromium path pointed at nothing): the e2e class skips, the 14 server tests after it pass, exit 0, no driver process left behind.

Review 1 findings

# Finding Status
1 Compact pager overlaps at larger fonts Closed for 20 and 24px at every compact width I probed (320, 360, 375, 414, 480, 600, 768). An overlap remains from about 30px up on middle pages; see the design question
2 Layout and stated behaviours unpinned Closed; see the mutation check
3 PR body details Closed (114, the scrollWidth note). Screenshots are still to be attached
4 Seed not tied to the page size Closed. The new test kills ±1 item, _PAGES of 10 or 12, and an edit to either Pa11y URL
5 sr-only text in e2e messages Closed (by reading)
6 Playwright driver not stopped on launch failure Closed in this module

Declining flex-wrap and nowrap is fine: the first cannot be triggered with 11 controls, the second is gone.

Mutation check

39 single-change mutants: CSS ones against the e2e module, template, seed and Pa11y-config ones against the server module.

  • The fix comment's list: all 13 it reports as failing fail here too. I split "revert the old grid columns" into with and without nowrap; both fail.
  • Its one survivor (deleting only grid-column: 3) survives here as well, and I agree it is equivalent.
  • My own 24: 15 killed, 9 survived.
    • Killed: nowrap back with the new columns; side columns back to minmax(0, 1fr); only one side min-content; float: none deleted; windowed gap of 2px; compact background deleted; Older's href pointed at the last page; changed label wording; wrong page number in Older's aria-label; changed link text; seed +1 item; _PAGES 10 and 12; both Pa11y URL edits.
    • Survived, equivalent (3): side columns as plain 1fr; a seed of 11 full pages; a literal 12 in place of the constant.
    • Survived, real: finding 1 (3 mutants) and finding 2 (3 mutants).

Findings

1. should-fix: the larger-text test passes when the pager overflows the screen instead of overlapping. Raised by Gemini (its finding 2); reproduced.

  • Defect: test_compact_pager_does_not_overlap_with_larger_text only compares neighbouring boxes with each other. Nothing checks that they stay inside the pager.
  • Reproduction: set the middle column to auto and put white-space: nowrap back on the label. At a 24px root font, 320px wide, page 14, Newer then starts at −34px (cut off at the left edge), Older ends at 354px, and the page scrolls sideways (scrollWidth 354). All four e2e tests still pass. Two more mutants survive for the same reason: a 6rem minimum on the middle column, and auto in place of minmax(0, auto).
  • Fix: in the same loop, assert that each box lies within g["nav"] (to 0.5px). All 17 current cases satisfy that at this head.

2. nit: three cosmetic properties of the compact form are unpinned.

  • Deleting any one of these leaves both modules green: text-align: center (added by this fix), the compact border-color: transparent (a visible box would come back around "Page N of M"), and align-items: center.
  • A computed-style assertion on borderColor and textAlign would cover the two that matter.

3. nit: the remaining overlap is a band, not one cell. The comment in the test says "Not checked: a 32px root font at 320px on a middle page". Measured at this head on a middle page, the label sits over Older at:

Root font Up to Notes
30px 330px wide 18px at 320, 8px at 330
32px 350px wide 33px at 320, 7px at 350; clear at 360
40px 430px wide the page also scrolls sideways at 360px and below

The wording should say so. Whether to change the behaviour is the design question below.

4. nit: the PR body is stale in places. "What ran where" still quotes the first run (30 e2e tests, 1231 tests, "14 tests" for the two modules); this head has 1235 and 32.

Design question for Jon: the overlap that remains at very large text

On the disagreement, the implementer is right and review 1 was wrong. At a 32px root font, 320px wide, page 14, the grid columns compute to 130px / 0px / 116px with two 24px gaps: 294px against a 290px list. Newer spans 13 to 143, Older 191 to 307 and the label 160 to 224, so the label sits 33px over Older. Those are the implementer's numbers exactly. The candidate CSS I suggested cannot fix this cell.

It is not a regression:

  • At 1963d79 the same cell had all three controls colliding (text overlaps of 72.5 and 58.5px). It is now one overlap of 33px.
  • At the default size nothing changed (next section).

The fix has two side effects at larger text, and none at 16px:

  • The label wraps, down to one word per line in the worst cases ("Page / 14 / of / 28", a pager 178px tall at 32px, up to 414px wide).
  • The label is no longer centred when one side is absent or the two links differ in width: 5.5px off on middle pages, up to 65px on the last page at 32px.

Recommendation: accept it as it is. A default font of 30px or more on a viewport of 350px or less is rare, and browser zoom, which WCAG 1.4.4 allows, already works: 200% zoom on a 640px window is the default-size 320px layout, which passes.

If no overlap at all is wanted, it needs a second layout, with the label on its own row above Newer and Older. One way is a max-width media query in em, just under 20em: media-query ems follow the browser's default font size, so that is about 318px at 16px (320px phones at the default size are untouched) and 597px at 30px. I have not built or tested this, and the current test technique (html { font-size }) would not trigger it. It belongs in a follow-up issue, not in this PR.

The "after" screenshots still hold

The screenshots predate the fix. They still show what this head renders at the default size:

  • Geometry: at a 16px root, the positions of Newer, the label and Older and the computed grid tracks are identical under the 1963d79 and e8cbf3d stylesheets at 320, 360, 375, 414, 480, 600 and 768px on pages 1, 14 and 28 (for example 76.5 / 113 / 76.5px at 320px on page 14). The same holds for a 100-page pager at 320 to 375px.
  • Pixels: within one page load, a screenshot of the pager before and after re-applying the old rules is byte-identical at 320, 375, 600, 768, 769 and 1280px on pages 1, 14 and 28.
  • The change is inside the max-width: 768px block, so the 1280px shot cannot be affected.

Not verified

  • Real screen-reader output.
  • A real browser default-font setting; the tests and my probes use html { font-size }.
  • Root fonts between the sampled sizes (18, 20, 22, 24, 26, 28, 30, 32 and 40px).
  • The em media-query sketch.

Second review: Gemini 4 Neon (xhigh) (gemini-4-neon-xhigh)

Four findings on the same range, each triaged by running or reading it. Totals: 3 confirmed, 1 partly valid, 0 rejected. The script excluded no files from the diff it sent.

# Finding Verdict Reason
1 news-listing.css: the single-row grid still overflows and collapses the label column at a 32px root font on a 320px viewport, and the label overflows its column at 330 to 360px Confirmed as fact; a design question, not a defect of this PR Its numbers match mine (130 + 116 + 48 = 294 against 290; a 6px middle column at 330px and 36px at 360px). At 360px the label overflows its own box without touching Older. Not a regression, and unchanged at the default size. See the design question and finding 3
2 test_news_pagination_e2e.py: the larger-text test checks pairwise overlap only, never that controls stay inside the pager Confirmed, should-fix My finding 1. Reproduced with two surviving mutants, one of which pushes Newer to −34px and makes the page scroll sideways while all four tests pass
3 test_news_pagination_e2e.py: in setUpClass, if cls._pw.stop() itself raises, super().tearDownClass() is skipped and the skip becomes an error Confirmed by reading, nit, not reproduced True of the code as written, but it needs the driver to die between start() and stop(). With Chromium simply missing, the class skips cleanly (run above). A try/finally would close it
4 test_news_pagination.py: parsing the Pa11y URLs with rsplit("=", 1) breaks on object entries, extra query parameters or fragments Partly valid, nit All 11 entries in .pa11yci.ci.json are plain strings today. If a news URL gained a parameter or became an object, the test would fail loudly (ValueError, or the list would no longer equal [6, 11]), which is what the test is for. Only an extra object-form news URL would be skipped unnoticed

Follow-up. None was needed: no finding that would be blocking or should-fix was rejected, so nothing is disputed.

🤖 Generated with Claude Code — review, triage and verdicts by Fable 5.2, claude-fable-5-2; second-review findings by gemini-4-neon-xhigh via Google Antigravity CLI

jonfroehlich and others added 3 commits December 5, 2026 10:57
Review 2 on #1504: the larger-text test compared neighbouring boxes
only, so a layout that pushed Newer off-screen and scrolled the page
sideways still passed (middle column auto plus nowrap: all four e2e
tests green). It now also asserts that Newer, the current item, the
label and Older lie within the pager. The compact test pins the current
item's transparent border and centred text, and the comment on the
skipped case describes the whole overlap band. setUpClass always runs
the parent teardown even if stopping the driver raises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY
#1503 (merged into master, now merged here) added
PlaywrightLiveServerTestCase in website/tests/e2e_base.py and a guard
that no test module imports playwright itself. The News pager module
now subclasses it and drops its own import, skip guard and
setUpClass/tearDownClass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVrfSvxzzAnNBQyanwwHJY
@jonfroehlich

Copy link
Copy Markdown
Member Author

Fix round 2: answers to review 2

New head: fc32521. Commits:

No CSS or template changes in this round.

CI run 47556927844 on fc32521:

Locally, with Playwright and Chromium, the full suite is 1280 tests with 2 failures. They are the same two image-version failures that also fail on master.

Fable 5.2 findings

1. Should-fix: the larger-text test never checks that controls stay inside the pager. Fixed in a4d7a31.

  • Reproduced first. With your mutant (middle column auto plus nowrap back on the label), the e2e module as it was at e8cbf3d passed: Ran 4 tests ... OK.
  • The test now also asserts that Newer, the current item, the label and Older each lie within g["nav"], to 0.5px.
  • Against the unmutated CSS, all cases pass. Mutants run against the new module, all killed:
Mutant Failing subtests
auto + nowrap 17
minmax(6rem, auto) 8
auto in place of minmax(0, auto) 3

2. Nit: compact cosmetics unpinned. Fixed in a4d7a31. The compact test now asserts that the current item's computed border-top-color is rgba(0, 0, 0, 0) and its text-align is center. Deleting either rule fails 8 subtests. I did not pin align-items: center; every item is 44px tall, so it has no visible effect at the sizes tested.

3. Nit: the remaining overlap is a band, not one cell. Fixed in a4d7a31. The comment now describes the band: 30px up to about 330px wide, 32px up to about 350px, 40px up to about 430px. It says that only the 32px/320px middle-page cell of the test's grid falls inside the band, and that a stacked layout is an open design question. I did not build the stacked layout. That is left for Jon.

4. Nit: stale counts in the PR body. Fixed by patching the body. It now gives fc32521's numbers: 18 tests in the two modules (14 server, 4 e2e); 1280 local; CI test 1248 and e2e 32. It also notes that the a11y counts are unchanged and that demo-ended-tall came from master.

Design question (stacked layout for very large text): no change here. It is Jon's call, and probably a follow-up issue.

Gemini findings

  1. Overflow and collapse at 32px/320px: agree. It is a fact about the remaining band, not a regression; see finding 3 and the design question.
  2. Pairwise-only check: fixed (finding 1).
  3. setUpClass skips the parent teardown if _pw.stop() raises: superseded.
    • a4d7a31 first wrapped it in try/finally.
    • fc32521 then removed this module's lifecycle code altogether. Since Share one Playwright lifecycle across e2e tests; stop the driver when launch fails (#1489) #1503 is now on master, the module subclasses PlaywrightLiveServerTestCase from website/tests/e2e_base.py, whose class cleanups cover exactly this case (test_stop_failure_on_skip_path_is_reported_not_swallowed).
    • The move was required anyway: master's test_no_test_module_imports_playwright would otherwise fail on this module. Locally, test_e2e_base passes (7 of 7 lifecycle tests, plus the guard), and the news e2e module runs, not skips.
  4. Pa11y URL parsing with rsplit("=", 1): decline, agreeing with the reviewer's "partly valid". All 12 entries are plain strings today. A query parameter or an object entry on a news URL makes the test fail loudly (ValueError, or a list that no longer equals [6, 11]), which is what the test is for.

🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5

@jonfroehlich

Copy link
Copy Markdown
Member Author

Closing check

Head read: fc32521 (whole PR against origin/master at 09211fe, not only the last fixes). No blocking finding and no new should-fix finding. One declined item from review 1 is listed under "Disagreed, not closed".

What ran where

  • Full suite plus all e2e modules, this head: Python 3.13.1, a throwaway image built from the local site image with Playwright 1.65.3 and Chromium, isolated Postgres 16. 1280 tests, 2 failures, 6 skipped (the ffmpeg tests). All 32 e2e tests and test_e2e_base ran and passed, none skipped.
  • The two failures are test_cleaner_kwargs_match_snapshot and test_hide_elements_includes_installed_toolbar_host. Both fail the same way on current origin/master (09211fe) in the same image, so they come from the image's older packages, not from this PR.
  • CI run 47556927844 is on this head. Read from the job logs: test 1248 OK (skipped=6); e2e 32 OK with all four test_news_pagination_e2e tests ok; the a11y per-URL counts match the PR body's table, and no finding names the pager.

Findings

None.

Review findings, checked at this head

Finding Status
Compact pager overlaps at larger fonts (review 1, finding 1; Gemini 5) Closed as far as it was claimed. Probed root fonts of 16 to 32px at 320, 360, 375, 414, 480, 600 and 768px on pages 1, 14 and 28: no overlap, nothing outside the pager and no sideways scroll up to 28px. The only failures are a middle page at 320px with a 30px root (label 18px over Older) and a 32px root (33px), the band the test comment describes. What to do about that band is the open stacked-layout question, not a finding
Untested layout (review 1, finding 2) Closed, except flex-wrap (below). Re-ran four mutants against the e2e module: no display: grid (16 failing subtests), no justify-self: end (5), the old grid columns with nowrap (20), middle column auto with nowrap replacing text-align (17)
Controls staying inside the pager (review 2, finding 1; Gemini 2) Closed. With the middle column set to auto and white-space: nowrap added (text-align: center kept), 9 subtests of the larger-text test fail, all on the new inside-the-pager assertions
Seed not tied to the page size (review 1, finding 4) Closed by reading and by the suite: SeedDemoNewsPagerTests passes, and .pa11yci.ci.json scans exactly ?page=6 and ?page=11

The commits after review 2 (a4d7a31, the merge e841808 and fc32521) change no CSS or template of this PR. The module uses the shared PlaywrightLiveServerTestCase, imports no playwright itself, and is in the e2e job's module list, as CLAUDE.md requires. I found no contradiction between the PR body, the code and the CI logs.

Disagreed, not closed

flex-wrap: wrap on the windowed pager is load-bearing and no test pins it. Reproduced.

  • Review 1 listed its removal as a surviving mutant (finding 2, lower value). Fix round 1 declined it because "no test can make it wrap without changing the markup", and review 2 agreed that it "cannot be triggered with 11 controls". Both statements hold only at the default font size.
  • At this head, page 14 of 28 wraps to two rows at a 24px root font at 769 and 800px, and at a 32px root font from 769 to 992px, with no sideways scroll. That is the right behaviour.
  • With the flex-wrap line deleted, the same cases scroll sideways: scrollWidth 896 at 769px, 911 at 800px, 961 at 900px and 1007 at 992px (32px root), and 770 at 769px (24px root). Both news modules still pass (18 tests OK).
  • A wide-width case in the larger-text test (for example a 32px root at 769px, asserting no sideways scroll) would pin it. The behaviour is correct today, so this is a test gap, not a defect in what ships.

Not verified

  • Real screen-reader output.
  • A real browser default-font setting; like the tests, my probes set html { font-size }.
  • The before/after screenshots, which the PR body still lists as to be attached.

🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2

@jonfroehlich
jonfroehlich merged commit eb1f1f7 into master Dec 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

News listing: pagination shows every page (28+), causing horizontal scroll and a poor mobile experience

1 participant