fix(projects): stop project-listing grid overflowing on mobile (#1367)#1368
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'srepeat(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-flexis now mobile-first: block by default,flexonly at>=992px, so the grid's parent reports a definite width on mobile/tablet.minmax(min(100%, 250px), 1fr)(a track can never exceed its container) +min-width: 0on.project-card.aspect-ratio: 5/3thumbnails (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.scrollWidthvs viewport (debug toolbar on, the condition that triggers the bug)Measured with faithful mobile emulation (Chrome DevTools
setDeviceMetricsOverride; headless--window-sizeis clamped to a 500px minimum and cannot reproduce real phone widths).python manage.py test website --settings=makeabilitylab.settings_test→ 455 passed, 8 skipped (no Python touched).Screenshots
Follow-ups
master/-test; prod is fixed by deploying (version bump + SemVer tag).