Skip to content

fix(mobile): render dialogs as bottom sheets below the md breakpoint - #1297

Open
JonasGao wants to merge 1 commit into
blinkospace:mainfrom
JonasGao:fix/mobile-dialog-bottom-sheet
Open

JonasGao wants to merge 1 commit into
blinkospace:mainfrom
JonasGao:fix/mobile-dialog-bottom-sheet

Conversation

@JonasGao

Copy link
Copy Markdown

Summary

The bottom-sheet form of Dialog and DialogStandalone only rendered for iOS user agents. Android phones, and any window narrower than 768px, got the centered HeroUI modal on the same mobile layout.

 const Dialog = observer(() => {
   const isPc = useMediaQuery('(min-width: 768px)')
-  const isIOS = useIsIOS()
   …
-  if (isIOS && isOpen) {
+  if (!isPc && isOpen) {
     return <BottomSheet />      // custom sheet
   }
   return <Modal />              // HeroUI, desktop only from here on
  • The sheet pads its bottom for the home indicator (env(safe-area-inset-bottom), 0.5rem where it is 0). It needs viewport-fit=cover from fix(mobile): size the bottom bar to the iOS tab bar standard and keep content clear of it #1295 to resolve on iOS.
  • Capped at 85dvh. Its body scrolls and the floating close button stays outside the scroll area.
  • The sheet surface (background, radius, safe-area padding) moved from the outer wrapper to the inner container, so the rounded corners reveal the backdrop instead of a strip of background.
  • containerClass and modalSizeClass are gone: they were only reachable from the iOS branch and never applied to the HeroUI modal.

Evidence

Chromium at 390×844, Android user agent, new-note dialog, main vs this branch:

Before After
New-note dialog on main: centered modal New-note dialog with this PR: bottom sheet

Top-left corner of the sheet, iOS user agent, zoomed. The notch shows a strip of background before and the backdrop after:

Before After
Sheet corner on main: background in the notch Sheet corner with this PR: backdrop in the notch

Merge Danger

Door: two-way

Blast Radius: Mobile dialogs

Every dialog on both providers switches from the centered modal to the sheet below 768px, on Android and in narrow desktop windows too. size and placement have no effect in that range, as on iOS before.

🤖 Generated with Claude Code

The bottom-sheet form was gated on the iOS user agent, so Android phones
got the centered HeroUI modal on the same mobile layout. Key the sheet
off the md breakpoint instead, so every mobile viewport shares one
dialog strategy.

- pad the sheet for the home indicator (env(safe-area-inset-bottom))
- cap it at 85dvh (minus the safe-area padding) and scroll its body; the
  floating close button stays outside the scroll area
- paint the sheet surface (background, radius, safe-area padding) on the
  inner container, so the rounded corner notches reveal the backdrop
  instead of a solid strip of background
- drop containerClass/modalSizeClass: they were only reachable from the
  iOS sheet branch and never applied to the HeroUI modal

Desktop (>= 768px) keeps the centered HeroUI modal.

Co-Authored-By: Claude Code <noreply@anthropic.com>

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.

1 participant