Repository navigation
Window the News pager and collapse it on mobile (#1486) - #1504
Conversation
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
left a comment
There was a problem hiding this comment.
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=6has two ellipses and?page=11one; the three named items stay newest. - Bootstrap 3: computed
float: noneandmargin-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-widthquery, 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: nowrapin anautogrid column. When the root font grows, the twominmax(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=14of 28 at 320px withhtml { 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_e2ealready 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), andtext-align: centerin place ofwhite-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: gridfrom the compact block, orgrid-column: 2, orgrid-column: 3; justify-self: end, orwidth: 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
hrefat?page=1. Older's target is caught only incidentally, by the 6-page test. - Lower value: removing
flex-wrap, thefloat/margin-leftreset, the compact plain-text rule ornowrap.
3. nit: PR body details.
- "103" pager contrast findings before: I count 114 across the four desktop URLs (0 after).
- The "before"
scrollWidthvalues 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_UNSAFEto 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
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
Fix round 1: answers to review 1New head: e8cbf3d. Commits: CI run 47549926782 on e8cbf3d:
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: Fable 5.2 findings1. Compact pager overlaps at larger default fonts. Fixed in e8cbf3d, with the test in a6ccad8.
2. Compact layout and stated behaviours not pinned. Fixed in a6ccad8 and e8cbf3d. New tests:
Mutation check against both modules: I applied each change below on its own and ran the two modules. All of them now fail:
One mutant survives, and it is equivalent: deleting only Declined, as low value:
3. PR body details. Fixed (body patched).
4. Seed not tied to the page size or tested. Fixed in e8cbf3d.
5. E2e failure messages include the sr-only text. Fixed in a6ccad8. The current item is now reported by the text of its 6. Playwright driver not stopped when launch fails. Fixed in this module only (a6ccad8).
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
🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5 |
jonfroehlich
left a comment
There was a problem hiding this comment.
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_snapshotandtest_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:
test1235 OK (skipped=32),e2e32 OK,a11ysuccess. - 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:
nowrapback with the new columns; side columns back tominmax(0, 1fr); only one sidemin-content;float: nonedeleted; windowed gap of 2px; compact background deleted; Older'shrefpointed at the last page; changed label wording; wrong page number in Older'saria-label; changed link text; seed +1 item;_PAGES10 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).
- Killed:
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_textonly compares neighbouring boxes with each other. Nothing checks that they stay inside the pager. - Reproduction: set the middle column to
autoand putwhite-space: nowrapback 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 (scrollWidth354). All four e2e tests still pass. Two more mutants survive for the same reason: a6remminimum on the middle column, andautoin place ofminmax(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 compactborder-color: transparent(a visible box would come back around "Page N of M"), andalign-items: center. - A computed-style assertion on
borderColorandtextAlignwould 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: 768pxblock, 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
emmedia-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
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
Fix round 2: answers to review 2New 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 findings1. Should-fix: the larger-text test never checks that controls stay inside the pager. Fixed in a4d7a31.
2. Nit: compact cosmetics unpinned. Fixed in a4d7a31. The compact test now asserts that the current item's computed 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 Design question (stacked layout for very large text): no change here. It is Jon's call, and probably a follow-up issue. Gemini findings
🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5 |
Closing checkHead read: fc32521 (whole PR against What ran where
FindingsNone. Review findings, checked at this head
The commits after review 2 (a4d7a31, the merge e841808 and fc32521) change no CSS or template of this PR. The module uses the shared Disagreed, not closed
Not verified
🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2 |
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.
sr-onlystring) along witharia-current="page", replacing "(current page)". Ellipses arearia-hiddenspans, 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). AddsNEWS_ITEMS_PER_PAGE = 12and apage_rangecontext variable built withget_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 addsflex-wrapas a safety net, resets Bootstrap 3'sfloat/margin-left: -1px, and adds onemax-width: 768pxblock for the compact form. Line endings stay CRLF, as in the file before.website/views/news_item.py: removes the unusedPaginator, EmptyPage, PageNotAnIntegerimport.website/management/commands/seed_demo_news.py+.pa11yci.ci.json: see decision 6.website/tests/test_news_pagination.py(server) andwebsite/tests/test_news_pagination_e2e.py(Playwright). The new e2e module is added to thee2ejob'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:
<link rel="prev/next">: out.aria-currentplus "Page N of M".seed_demo_newsnow 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-websiteimage 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.For example,
test_middle_page_is_boundedfails withAssertionError: 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: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) andtest_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.
scrollWidthis 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.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:
/news//news/?page=2/news/?page=14/news/?page=28/news/?page=14at 320×700Before, 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):
//people//publications//projects//news//news/?page=6(new, two ellipses)/news/?page=11(new, last page)/awards//project/demo-active-tall//member/demolovelace//news/demo-news-one/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:
NEWS_ITEMS_PER_PAGE.The per-finding answers are in the PR conversation.
Screenshots
Before and after, middle page (
?page=14of 28) with the pager in view, at 1280, 768, 375 and 320px. Jon will attach them.What ran where
testjob.e2ejob (report-only). At fc32521 (run 47556927844), its log shows all fourtest_news_pagination_e2etests ran and passed (... ok, none skipped), withinRan 32 tests ... OK. CI'stestjob:Ran 1248 tests ... OK (skipped=6). The module now uses the sharedPlaywrightLiveServerTestCasefromwebsite/tests/e2e_base.py(Share one Playwright lifecycle across e2e tests; stop the driver when launch fails (#1489) #1503, merged into this branch).test_pa11y_ci_configfails locally, on master as well.🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5