Skip to content

Commit 7233d97

Browse files
prazgaitisclaude
andauthored
Fix mobile keyboard causing drawer layout to break (#226)
Use svh instead of dvh for drawer max-height so the drawer stays stable when the mobile keyboard opens (dvh shrinks with the visual viewport). Add handleOnly to Vaul drawer so form scrolling doesn't accidentally dismiss the drawer. https://claude.ai/code/session_012VxAku4ep8JjdDU2yQotRf Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9aff1b7 commit 7233d97

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

apps/web/components/ui/responsive-dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function ResponsiveDialog({
8585
if (isMobile) {
8686
return (
8787
<ResponsiveDialogContext.Provider value={{ isMobile: true }}>
88-
<Drawer open={open} onOpenChange={onOpenChange}>
88+
<Drawer open={open} onOpenChange={onOpenChange} handleOnly>
8989
{children}
9090
</Drawer>
9191
</ResponsiveDialogContext.Provider>
@@ -122,7 +122,7 @@ function ResponsiveDialogContent({
122122

123123
if (isMobile) {
124124
return (
125-
<DrawerContent className={cn("max-h-[96dvh]", className)}>
125+
<DrawerContent className={cn("max-h-[96svh]", className)}>
126126
{children}
127127
</DrawerContent>
128128
);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Fix Mobile Keyboard Layout Issues in Activity Log Drawer
2+
3+
**Date:** 2026-03-16
4+
5+
## Problem
6+
7+
When logging a new activity on mobile, opening the keyboard causes the responsive dialog (Vaul drawer) layout to break. The drawer resizes when the keyboard appears and doesn't properly restore when the keyboard is dismissed.
8+
9+
## Root Cause
10+
11+
The `DrawerContent` in `responsive-dialog.tsx` uses `max-h-[96dvh]` (dynamic viewport height). On mobile:
12+
- `dvh` shrinks when the virtual keyboard opens (it tracks the visual viewport)
13+
- This causes the drawer to collapse/resize, pushing content around
14+
- When the keyboard dismisses, the resize animation is janky and doesn't fully recover
15+
16+
Additionally, the Vaul drawer allows swipe-to-dismiss from anywhere inside the content, which conflicts with scrolling the form.
17+
18+
## Solution
19+
20+
- [x] Change `max-h-[96dvh]` to `max-h-[96svh]``svh` (small viewport height) stays stable regardless of keyboard state
21+
- [x] Add `handleOnly` prop to the Vaul Drawer so only the drag handle triggers dismiss, not form scrolling
22+
23+
## Implementation Notes
24+
25+
- `svh` is the smallest viewport height (accounts for browser chrome but NOT the keyboard)
26+
- The browser natively scrolls focused inputs into view above the keyboard
27+
- `handleOnly` prevents accidental drawer dismissal when users scroll the activity form

0 commit comments

Comments
 (0)