Skip to content

Conversation

@eriknson
Copy link
Owner

@eriknson eriknson commented Jan 6, 2026

Optimize mobile chat and keyboard mechanics for a robust and great UX on any page.

This PR addresses common mobile chat issues by improving keyboard detection across iOS and Android, ensuring the composer stays above the keyboard, enhancing scrolling behavior to auto-scroll to the bottom, and refining viewport handling with 100dvh and body scroll prevention. It also includes touch interaction improvements like minimum font sizes and tap targets, and performance optimizations for smoother scrolling.


Open in Cursor Open in Web

- Enhanced keyboard detection hook to work across all mobile devices (iOS, Android)
  - Renamed useIOSKeyboard to useMobileKeyboard for broader device support
  - Added fallback for browsers without visualViewport API
  - Improved keyboard visibility detection with better thresholds
  - Added focus/blur event handlers for more reliable detection

- Improved composer positioning to stay above keyboard reliably
  - Better transform calculations accounting for safe area insets
  - Smooth transitions when keyboard opens/closes
  - Prevents composer from being hidden behind keyboard

- Optimized scrolling behavior when keyboard opens/closes
  - Auto-scroll to bottom when keyboard opens
  - Uses requestAnimationFrame for smooth DOM updates
  - Added bottom anchor scrolling for reliability
  - Prevents layout jumps and viewport shifts

- Enhanced viewport height handling for mobile browsers
  - Uses 100dvh (dynamic viewport height) for better mobile support
  - Added fallbacks for browsers without dvh support
  - Fixed body scroll prevention when app is mounted
  - Better handling of safe area insets

- Improved touch interactions and prevented unwanted zoom
  - Set minimum font-size to 16px to prevent iOS zoom on focus
  - Improved tap targets (minimum 44px)
  - Disabled tap highlight for cleaner interactions
  - Prevented pull-to-refresh on mobile

- Added mobile-specific CSS optimizations
  - Hardware acceleration for smooth scrolling
  - Overscroll behavior containment
  - Better performance with will-change and backface-visibility
  - Responsive font sizes for inputs

These changes ensure the chat interface works smoothly on any mobile device
with proper keyboard handling, scrolling, and viewport management.
@cursor
Copy link

cursor bot commented Jan 6, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
cursor-web Ready Ready Preview, Comment Jan 7, 2026 11:04am

@eriknson
Copy link
Owner Author

eriknson commented Jan 6, 2026

@cursor does this change the look and feel of the UI flows in any way? any arguments for not merging this in?

@cursor
Copy link

cursor bot commented Jan 6, 2026

❌ Unable to add follow-up after multiple attempts. The agent may be experiencing issues.

Please try again later or Open in Web to view the status.


Open in Cursor Open in Web

Learn more about Cursor Agents

- Changed pull-to-refresh prevention from global (body) to scroll-container only
  - Allows page-level pull-to-refresh to still work if needed
  - Only prevents pull-to-refresh within conversation scroll area
  - This is a common pattern for chat apps (Slack, Discord)

- Removed duplicate fixed positioning on app container
  - Body already has fixed positioning on mobile
  - Prevents potential conflicts with dropdowns/modals

- Made font-size override more targeted
  - Only applies to textarea (composer), not all inputs
  - Prevents iOS zoom while preserving other input styling

- Added opt-out class for touch target sizing
  - Buttons can use .no-min-size to opt out if needed
  - Follows accessibility guidelines while maintaining flexibility
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.

3 participants