Skip to content

feat(web-ui): establish shared responsive layout and viewport conventions - #1610

Open
Mittalnew wants to merge 3 commits into
TabularisDB:mainfrom
Mittalnew:feat/1581-responsive-conventions
Open

Mittalnew wants to merge 3 commits into
TabularisDB:mainfrom
Mittalnew:feat/1581-responsive-conventions

Conversation

@Mittalnew

@Mittalnew Mittalnew commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds the shared responsive conventions from #1581 so the rest of #1580 builds on the same breakpoints, viewport sizing and touch rules. Only the root shell's sizing changes; the desktop layout looks exactly the same. Navigation, dialogs and per-screen changes are left to their own issues (#1582, #1583, ...).

Changes

  • Breakpoints: compact below 768 px, intermediate from 768 to 1023 px, wide from 1024 px. md and lg are pinned in the @theme block of index.css, and BREAKPOINTS / MEDIA_QUERIES in src/utils/responsive.ts hold the same values for code. I checked these against the shell: the icon rail plus the default explorer take 320 px, so below 768 px the main area would be under 448 px. With the row editor open, the main area is down to 320 px at 1024 px.
  • Touch target: a touch spacing token (44 px), used as pointer-coarse:min-h-touch pointer-coarse:min-w-touch. Touch rules depend on the input device, not on width.
  • Viewport: the viewport meta adds viewport-fit=cover and interactive-widget=resizes-content. Zoom is still allowed.
  • Root shell: MainLayout uses h-dvh instead of h-screen, and a new safe-area-padding utility (env(safe-area-inset-*)). body uses min-height: 100dvh. On desktop and in the Tauri window the insets are 0, so nothing moves there.
  • Behavior hook: useMediaQuery(query) and useViewportLayout() (compact / intermediate / wide) in src/hooks/useMediaQuery.ts, built on useSyncExternalStore and cleaning up on unmount. Nothing uses them yet. They are meant for the follow-up issues, only where behavior has to change.
  • Docs: a new "Responsive layout" section in docs/DESIGN.md covers breakpoints, container queries, input capability and touch targets, viewport and safe areas, the keyboard, scroll ownership, and the rule that resizing must not write saved preferences. .rules/design.md gets a short rule pointing to it.

No new UI strings, no theme color changes, no backend changes.

Notes for review

Testing

  • pnpm test: 624 files, 9911 tests passed, including the new tests/hooks/useMediaQuery.test.ts (live updates, unsubscribing on unmount, re-subscribing when the query changes, and the breakpoint edges 767/768/1023/1024) and a MainLayout test for the shell classes.
  • pnpm typecheck, pnpm lint (ESLint, Prettier, theme tokens) and pnpm build pass.
  • Manual check against a local tabularis web server (SQLite connection) in headless Chrome 156, before and after, at 320×640, 390×844, 844×390, 768×1024 and 1280×800. Safe-area insets were emulated through the DevTools protocol. At every size document.documentElement.scrollWidth equals the viewport width (no page-level horizontal scroll), and the shell height equals the viewport height. With insets, the shell now pads by exactly the inset (for example 47px 0 34px in portrait), where before it had none.
  • Not yet checked on a real iPhone or Android device, so I haven't seen real toolbar or keyboard behavior. I'd appreciate a check there, or I can add real-device captures later.

Closes #1581

Screenshots

5-wide-1280x800-after 5-wide-1280x800-before 4-intermediate-768x1024-after 4-intermediate-768x1024-before 3-compact-320x640-after 3-compact-320x640-before 2-phone-landscape-844x390-after 2-phone-landscape-844x390-before 1-phone-portrait-390x844-after 1-phone-portrait-390x844-before
tabularis-1581-responsive.mp4

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ions

Define the compact (<768), intermediate (768-1023) and wide (>=1024) breakpoints, a 44px touch target token, and a useMediaQuery/useViewportLayout hook for behavior that changes with the viewport. Size the root shell with dvh and safe-area insets, opt the viewport into viewport-fit=cover and interactive-widget=resizes-content, and document the conventions in DESIGN.md.

Closes TabularisDB#1581
@kilo-code-bot

kilo-code-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental review: BREAKPOINTS and MEDIA_QUERIES in responsive.ts now use rem (48 and 64) instead of px. This matches Tailwind's rem-based md and lg breakpoints. Nothing else in the repo uses BREAKPOINTS as a px value. The updated tests and docs/DESIGN.md are consistent with the change.

Files Reviewed (3 files)
  • docs/DESIGN.md
  • packages/web-ui/src/utils/responsive.ts
  • packages/web-ui/tests/hooks/useMediaQuery.test.ts
Previous Review Summaries (2 snapshots, latest commit fd924ff)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit fd924ff)

Status: No Issues Found | Recommendation: Merge

Incremental review: the only change since the last review is generated guest CSS (src-tauri/resources/guest/host.css). It adds --spacing-touch, .h-dvh, .min-h-touch, .safe-area-padding and a 100dvh body min-height. These match the earlier web-ui changes.

Files Reviewed (1 file)
  • src-tauri/resources/guest/host.css

Previous review (commit d4561ba)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (9 files)
  • .rules/design.md
  • docs/DESIGN.md
  • packages/web-ui/index.html
  • packages/web-ui/src/components/layout/MainLayout.tsx
  • packages/web-ui/src/hooks/useMediaQuery.ts
  • packages/web-ui/src/index.css
  • packages/web-ui/src/utils/responsive.ts
  • packages/web-ui/tests/components/layout/MainLayout.test.tsx
  • packages/web-ui/tests/hooks/useMediaQuery.test.ts

Reviewed by claude-sonnet-5.5 · Input: 254 · Output: 871 · Cached: 172.7K

Review guidance: REVIEW.md from base branch main

debba
debba previously approved these changes Nov 19, 2026

@debba debba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Mittal. I appreciate the breakpoint boundary tests and the guidance on when to use pointer capabilities. One follow-up nit is to use the same units in the Tailwind breakpoint tokens and the JavaScript media queries. The CSS uses rem and the hook uses px, so they can disagree if the browser’s default font size differs from 16 px. I’ll keep this open for manual layout checks before merging.

@Mittalnew

Copy link
Copy Markdown
Contributor Author

Thanks @debba! Good catch on the units, I'll align the hook's media queries to rem so they match the Tailwind tokens and push a follow-up commit.

…oints

BREAKPOINTS now holds rem values (48, 64) matching the md and lg tokens in index.css, so the useViewportLayout media queries agree with Tailwind when the browser default font size is not 16px. Tests now resolve rem against a configurable font size and cover a 20px default.
@Mittalnew

Copy link
Copy Markdown
Contributor Author

@debba Pushed the follow-up (6d3b2fe): the hook's media queries now use rem (48rem / 64rem) from the shared BREAKPOINTS constant, so they match the Tailwind md/lg tokens regardless of the browser's default font size. I also updated the boundary tests and added a case with a 20px default font size.

@debba debba left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Mittal. You switched BREAKPOINTS to rem and added the 20px default font cases, so the hook and the md/lg tokens now come from the same numbers.

I ran the hook and MainLayout tests on the branch (22 passing). I also checked it in a real Chromium with the default font set to 20px: at 900px, both the Tailwind md rule and (min-width: 48rem) say compact, while the old 768px query said intermediate. So the fix does what it should.

I'm approving this. One small follow-up, not a blocker: BREAKPOINTS now holds unitless rem numbers, and it would be easy to compare one against a px width by mistake. #1612 already plans to import it into a Playwright spec that compares against viewport.width. A px helper or a unit in the name (BREAKPOINTS_REM) would prevent that. It can be a separate small PR.

I'll do the manual layout check on desktop and on a phone before I merge.

This branch has not been deployed

No deployments
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.

[Feat]: Mobile: establish shared responsive layout and viewport conventions

2 participants