Repository navigation
Tighten the Projects topic sidebar and match topics exactly (#1474) - #1476
jonfroehlich wants to merge 4 commits into
Conversation
Direction A from the design review: the page header moves above both columns, the sidebar is col-md-3/col-lg-2, "Topics" and a link-style "Clear" share a heading row, counts are plain tabular numerals inside each button's accessible name, the selected row is a tint plus a left bar, and focus rings use :focus-visible with an inset offset. Fix the filter matching "Design" inside "Maker/Design Tools": cards now render their umbrella short names joined by "|", and the JS splits the list and compares whole names. Add tests for both the markup and the exact-match format. Bump to 2.35.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The labels are ProjectUmbrella.short_name, which editors type freely, so a lowercase entry rendered as "accessibility". text-transform: capitalize only uppercases first letters, leaving "EdTech" and "AR" as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code review, round 1 of 2Reviewed head Summary: no blocking findings. Two should-fix items, two decisions for the maintainer, and some nits. The filter logic is correct and the PR body's numbers check out. Nothing was rendered in a browser (none was available to me either), so every layout statement below is derived from the CSS and real font metrics and is marked as such. Should-fix1.
2. The JavaScript half of the bug fix has no automated test
Needs a maintainer decision3.
4.
Nits
PR-body claims
Behaviour check of the JavaScript (Node, hand-rolled DOM stub, real file)20 assertions pass at head: exact match from the desktop buttons and from the mobile Mutation results (new test module, 7 tests)
No CSS is under test, which is normal for this repo. Still unverified
🤖 Generated with Claude Code — Fable 5.2, claude-fable-5-2 |
Review round 1 on PR 1476 found the JS half of the exact-match fix had no test: substring matching, a ',' delimiter, or a lower-cased mobile <option value> all left the suite green. test_project_listing_e2e.py runs project-listing-filter.js under Playwright (desktop buttons, mobile <select>, Clear) and kills all three mutations; the CI e2e job now runs it. It also pins the hairline alignment the review predicted would break: .section-heading's absolute 22px line-height was inherited by the .header-anchor icon, whose middle-aligned 22px box grew the line box and dropped the "Active Projects" rule 1.81px below the "Topics" rule (measured at 1024px). The anchor now gets line-height: 1; delta is 0 at 992, 1024, 1199, 1200 and 1440px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The count's accessible name now pluralizes ("AR 1 project"); tests pin
both "1 project" and "2 projects".
- CSS comments: "Clear" does scroll away with the heading row when the
sidebar overflows; the grid's parent is .col-md-9 .col-lg-10, not
.col-md-10.
- The "Clear" markup test uses assertInHTML instead of a regex that pinned
attribute order and whitespace.
- New assertions: the mobile <option value>s equal the buttons'
data-filter values, and the JS KEYWORD_DELIMITER equals the one the
tests split the template output on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #1474
Implements "Direction A" (tightened sidebar) from the design review, plus the substring-match bug in the topic filter.
Changes
Template (
project_listing.html)<header class="projects-header">(h1 + mobile<select>) moves above the two columns, so the h1 now precedes the filter's h2 in DOM order and the sidebar heading shares a hairline with "Active Projects".col-md-3 col-lg-2/col-md-9 col-lg-10(wascol-md-2at 992–1199px, which wrapped labels)..filter-headrow. The reset button keepsid="filter-reset-btn"and itsaria-label, now reads "Clear" (no icon), and starts with thehiddenattribute.aria-describedbyandfilter-count-Nids are gone; the count is part of the button's name instead (53<span class="sr-only"> projects</span>). The JS never referenced those ids.CSS (
project-listing.css)--color-primary-lighttint + 3px--color-primaryleft bar + medium weight (not colour-only).:focus→:focus-visiblewith an inset (-2px) ring, so it isn't clipped by the sticky sidebar's scroller and doesn't stick after a mouse click.--color-link.margin-left: -8px) so label text aligns with the h1; the stray trailingmargin-top: 15pxandpadding-rightare removed;.section-headinggetsline-height: 22pxso its hairline meets the filter heading's.<select>is unchanged.Bug fix: exact topic matching
display_project_snippet.htmlrendereddata-project-keywordsas space-joined umbrella short names, andproject-listing-filter.jsmatched withindexOf, so "Design" also showed every "Maker/Design Tools" project (and short names with spaces were ambiguous). The card now renders a|-joined list, and the JS splits it and compares whole names (cardHasTopic). Both sides still useProjectUmbrella.short_name, the key the view's umbrella map and the button/select values already use.|would still break this; none do today.Version: 2.35.6. (Another open PR may also bump the version; whichever merges second needs a re-bump.)
Contrast (computed from design-tokens.css values, WCAG 2.x formula)
The old selected state (white count on a translucent pill over #1565A7) was about 4.0:1.
Tests
website/tests/test_project_listing_filter.py: a project in both "Design" and "Maker/Design Tools" renders both names whole; a "Maker/Design Tools"-only card does not contain "Design"; buttondata-filtervalues equal the card values; the space-joined format is gone; h1 precedes the filter h2; the count is inside the button's name; "Clear" starts hidden with its label. Four of these fail against the old snippet.python manage.py test website --settings=makeabilitylab.settings_testran 836 tests: OK (8 skipped). It ran in a one-offmakelab_imagecontainer mounting this branch, against a throwaway Postgres 16 container.Still needed before merge
col-md-3) or at 1200px+ (col-lg-2, the tighter of the two); "Clear" appears in the heading row after a click; the mobile select is unchanged.--profile testing run --rm a11y); not run here.🤖 Generated with Claude Code — Opus 5.5, claude-opus-5-5