Repository navigation
fix(ui): keep formula editor within the viewport on small screens - #256
Conversation
The formula editor card carried a flat `minWidth: 600`, and the editor opens in a flyout anchored to a property header, so on a phone the card was 600px wide inside a 375px viewport and the page scrolled sideways (~247px of horizontal overflow measured at 375px). The card is now `width: min(600px, calc(100vw - 32px))`: still 600px on a wide screen, but never wider than the viewport minus the 16px gutters. The two detail panels carried their own `minWidth: 500` floor and get the same treatment. The properties and functions grids also collapsed to a single column at 375px — the 150px/120px column floors still forced two cramped columns in a ~343px card. The properties grid's template moved from an inline style to CSS so the media query can actually override it, and both card item groups drop the primitive's `min-width: max-content`, which would otherwise stop them narrowing. Verified at 320/375/480/600/900/1280px: no horizontal overflow at any width, single column at 375px, 600px card on desktop. Closes #200 Signed-off-by: Furox-Art <[email protected]>
|
@Furox-Art is attempting to deploy a commit to the sall25's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks @Furox-Art — clear write-up and the right fix. Dropping the primitive's One small follow-up, not blocking:
Something like Also worth knowing: with Approving — the follow-up can be a separate small PR. |
What
The formula editor overflows the viewport on phones.
formula-editor.tsxgave the card a flatminWidth: 600, and the editor opens in a flyout anchored to a property header, so at a 375px viewport the card was 600px wide and the page scrolled sideways.Changes
Card width —
minWidth: 600→width: min(600px, calc(100vw - 32px)). Still 600px on a wide screen, never wider than the viewport minus 16px gutters.Two more
minWidth: 500floors —property-detail.tsxandfunction-detail.tsxcarried the same kind of fixed floor and would have overflowed on their own; they now use the samemin(500px, calc(100vw - 32px)).Single-column grids at 375px — both grids drop to one column:
Two details were needed to make that actually work:
grid-template-columnswas an inline style, and inline styles beat any stylesheet rule, so a media query alone would have had no effect. The template moved intoformula-bar.scssas.formula-properties__grid.minWidth: 0. The shared card primitive pinsmin-width: max-content, which refuses to shrink below content width and would have kept the panels wide inside a viewport-bound card.How it was tested
Measured in headless Chromium against the compiled
card.scss+formula-bar.scss, so the shipped rules (including the new media query) are what's being measured. Headless Chrome clamps--window-sizeto 500 CSS px, so each width was driven through an iframe sized to exactly that viewport —100vwand media queries resolve against the iframe's own initial containing block.At 375px both grids report a single
323pxcolumn with each item on its own row; at 480px+ they reflow to multiple columns. The card is pinned at exactly 600px from 632px viewport width upward.Project checks, all passing locally, using CI's own commands:
CI
The workflow run on this PR is sitting at
action_requiredwith 0 jobs — that's GitHub's approval gate for workflows from fork pull requests, not a failure. Every previouspull_requestrun in this repo that succeeded came fromSall25/folioitself; the fork PRs never ran. Approving the run needs admin rights on the repository, which I don't have, so CI stays pending until someone with admin clicks approve. The commands above are exactly what CI runs, so they should pass once it does.Not tested
I could not click through the real UI: the editor lives behind a signed-in session with a Supabase
.env.local, and the landing-page editor doesn't render the database property config. The measurements above are against the real compiled CSS in a real engine, but not against live React render output. Worth a quick look on a phone to confirm the flyout also positions correctly now that it's narrower — Radix collision handling should shift it, but that's the one thing static layout can't show.Closes #200