fix(ui): keep api tokens table on screen at phone widths #6
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/api-tokens-table-mobile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The API tokens table overflowed the page on phones: the six-column table had no scroll container and no minimum width, so it could not shrink below its min-content size, spilled out of its card and widened the document. The whole page (navigation included) shifted sideways and the
Revokebutton ended up off screen.Root cause
users/templates/users/api_tokens.htmlrendered<table class="w-full text-xs">directly inside the.card-neopanel. A table's minimum width is the sum of its columns' min-content widths, sow-fullcould not compress it at 390px. Nothing constrained the overflow, and the card does not clip, so the overflow propagated to the document.Measured before the fix at a 390x844 viewport: document
scrollWidth514 vsclientWidth390 -> 124px of horizontal page overflow; the table was 459px wide against a ~280px card content box; the Revoke button's right edge sat at 514px, outside the viewport.Changes
users/templates/users/api_tokens.html- table wrapped in a.table-scrollcontainer and givenmin-w-[34rem], so it scrolls horizontally inside its card while columns stay readable. Token, Created, Expires and Status cells arewhitespace-nowrapso values do not break mid-token or mid-date.dome/static/css/base.tailwind- new.table-scrollcomponent (w-full max-w-full overflow-x-auto) with an intent comment.DESIGN.md- layout rule: dense tables never widen the page; they scroll inside a.table-scrollcontainer.dome/static/css/base.css- recompiled with the Tailwind CLI (tailwindcss v4.3.3,--minify).Tests and checks
python manage.py check->System check identified no issues (0 silenced).python manage.py test->Ran 82 tests in 33.138s->OK (expected failures=1)git diff --check-> clean.table-scrolland.min-w-\[34rem\]Visual verification (390x844 and 1280x900)
Method: the page was rendered through Django's test client for the
qa-localfixture account and loaded in a real Chromium at an emulated mobile viewport, with the compiledbase.cssinlined; layout was measured withgetBoundingClientRect/scrollWidth. This is the real DOM of the route with real CSS, but not a live authenticated session - the fixture account has an unusable password and no credentials were typed anywhere. Local-only, gitignored SQLite database; nothing on the deployed instance was touched.Risk / rollback
Presentation only: no routes, forms, HTMX attributes or request semantics changed. Revert the single commit to roll back. One cosmetic consequence at phone width: the table now scrolls horizontally (with a visible scrollbar under the card) instead of squeezing columns into unreadable widths.
Screenshots
Before - 390x844: page shifted sideways, 124px document overflow, Revoke off screen
After - 390x844: page aligned, 0px document overflow, table scrolls inside its card
After - 390x844, table scrolled right: Revoke reachable
After - 1280x900: desktop unchanged
Visual verification
Route rendered through Django's test client for the
qa-localfixture account and loaded in real Chromium at an emulated mobile viewport with the compiledbase.cssinlined; layout measured viascrollWidth/getBoundingClientRect.This is the real DOM of the route with real CSS, but not a live authenticated session: the fixture account has an unusable password and no credentials were typed. Local gitignored SQLite database only; nothing on the deployed instance was touched.
Before - 390x844: page shifted sideways, 124px document overflow, Revoke off screen
After - 390x844: page aligned, 0px document overflow, table scrolls inside its card
After - 390x844, table scrolled right: Revoke reachable
After - 1280x900: desktop unchanged