Skip to content

fix(projects): stop project-listing grid overflowing on mobile (#1367)#1368

Merged
jonfroehlich merged 1 commit into
masterfrom
1367-project-listing-mobile-overflow
Jun 22, 2026
Merged

fix(projects): stop project-listing grid overflowing on mobile (#1367)#1368
jonfroehlich merged 1 commit into
masterfrom
1367-project-listing-mobile-overflow

Conversation

@jonfroehlich

@jonfroehlich jonfroehlich commented Jun 22, 2026

Copy link
Copy Markdown
Member

Fixes #1367.

Problem

On /projects/, the layout overflows horizontally on mobile — thumbnails and the filter UI get cut off on the right.

Root cause

Below the 992px sidebar breakpoint, .row-flex { display: flex } kept the content column (.col-md-10) a flex item with an indefinite width, so the grid's repeat(auto-fill, minmax(250px, 1fr)) resolved a track wider than the viewport whenever sibling content (e.g. the always-on django-debug-toolbar in local dev) nudged the flex container wider — blowing the page out horizontally.

Fix (CSS/template only)

  • .row-flex is now mobile-first: block by default, flex only at >=992px, so the grid's parent reports a definite width on mobile/tablet.
  • Hardened the grid track: minmax(min(100%, 250px), 1fr) (a track can never exceed its container) + min-width: 0 on .project-card.
  • Polish: aspect-ratio: 5/3 thumbnails (anti-CLS), hover-zoom gated behind @media (hover: hover) (no sticky zoom after tap), 2-line titles below 992px, loading="lazy" + decoding="async" on thumbnails.

Verification — document.scrollWidth vs viewport (debug toolbar on, the condition that triggers the bug)

Viewport before after
360px 476px 🔴 360px ✅
390px 477px 🔴 390px ✅
430px 476px 🔴 430px ✅
768px ok 768px ✅ (2 cols)
991px ok 991px ✅ (3 cols)

Measured with faithful mobile emulation (Chrome DevTools setDeviceMetricsOverride; headless --window-size is clamped to a 500px minimum and cannot reproduce real phone widths).

  • python manage.py test website --settings=makeabilitylab.settings_test455 passed, 8 skipped (no Python touched).
  • Pa11y: only the pre-existing site-wide footer-contrast findings; nothing on any element changed here.

Screenshots

true_360

Follow-ups

Below the 992px sidebar breakpoint, .row-flex kept the content column a
flex item with an indefinite width, so the grid's
repeat(auto-fill, minmax(250px, 1fr)) resolved a track wider than the
viewport whenever sibling content (e.g. the always-on debug toolbar in
local dev) nudged the flex container wider — blowing the page out
horizontally and cutting thumbnails / the filter UI off on the right.

- Make .row-flex mobile-first: block by default, flex only at >=992px,
  so the grid's parent reports a definite width on mobile/tablet.
- Harden the grid track: minmax(min(100%, 250px), 1fr) so a track can
  never exceed its container; add min-width: 0 to .project-card.
- Polish: aspect-ratio 5/3 on thumbnails (anti-CLS), gate hover-zoom
  behind @media (hover: hover) (no sticky zoom after tap), allow 2-line
  titles below 992px, and lazy/async-decode the thumbnail <img>.

Verified with faithful mobile emulation (toolbar on): scrollWidth ==
viewport at every width 360-991px after the fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonfroehlich jonfroehlich merged commit 802d923 into master Jun 22, 2026
3 checks passed
@jonfroehlich jonfroehlich deleted the 1367-project-listing-mobile-overflow branch June 22, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project listing page: thumbnails / layout overflow horizontally on mobile

1 participant