Skip to content

feat: mobile responsive bottom sheet with swipe-to-close#27

Merged
PAMulligan merged 9 commits intomainfrom
5-mobile-responsive-layout-with-full-screen-bottom-sheet
Mar 25, 2026
Merged

feat: mobile responsive bottom sheet with swipe-to-close#27
PAMulligan merged 9 commits intomainfrom
5-mobile-responsive-layout-with-full-screen-bottom-sheet

Conversation

@PAMulligan
Copy link
Copy Markdown
Contributor

Summary

  • On mobile (<640px), the chat widget renders as a full-width bottom sheet (~90vh) instead of a floating card
  • Swipe-to-close gesture with velocity (>500px/s) and distance (>30% of sheet height) thresholds
  • Dark scrim backdrop behind the sheet (tap to close)
  • Drag handle bar at the top of the sheet
  • prefers-reduced-motion support: opacity fade replaces slide animation, transforms disabled
  • Toggle button hidden when bottom sheet is open to avoid z-index overlap
  • Desktop behavior completely unchanged

New files

  • widget/src/hooks/useSwipeToDismiss.ts - vanilla JS touch event handler (no dependencies)
  • widget/src/hooks/useMediaQuery.ts - reactive CSS media query hook
  • Tests for both hooks

Changed files

  • ChatWidget.tsx - mobile detection, scrim backdrop, toggle button visibility
  • ChatWindow.tsx - conditional bottom sheet layout, drag handle, swipe integration
  • styles.css - CSS transitions for bottom sheet slide-up and reduced-motion overrides
  • test-setup.ts - matchMedia polyfill for jsdom

Test plan

  • 88 unit/integration tests pass (13 new tests added)
  • Production build succeeds
  • Visual: mobile (375x812) - bottom sheet, scrim, drag handle verified
  • Visual: desktop (1280x800) - floating card unchanged
  • Scrim tap-to-close works
  • Close button works, toggle reappears with focus
  • Reduced motion CSS verified (transform: none, opacity transition)

🤖 Generated with Claude Code

Paul Mulligan and others added 9 commits March 25, 2026 14:18
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The toggle button (z-50) was rendering on top of the bottom sheet
input area. Now hidden when isOpen && isMobile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan linked an issue Mar 25, 2026 that may be closed by this pull request
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 25, 2026

Deploying chat-widget with  Cloudflare Pages  Cloudflare Pages

Latest commit: 66c64c2
Status: ✅  Deploy successful!
Preview URL: https://2c75cd32.chat-widget-ejc.pages.dev
Branch Preview URL: https://5-mobile-responsive-layout-w.chat-widget-ejc.pages.dev

View logs

@PAMulligan PAMulligan self-assigned this Mar 25, 2026
@PAMulligan PAMulligan added enhancement New feature or request widget Chat widget UI and embed functionality accessibility Accessibility and WCAG compliance labels Mar 25, 2026
@PAMulligan PAMulligan moved this from Todo to Done in PMDS Open Source Roadmap Mar 25, 2026
@PAMulligan PAMulligan added this to the v1.0.0 milestone Mar 25, 2026
@PAMulligan PAMulligan merged commit 63c1b08 into main Mar 25, 2026
2 checks passed
@PAMulligan PAMulligan deleted the 5-mobile-responsive-layout-with-full-screen-bottom-sheet branch March 30, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility and WCAG compliance enhancement New feature or request widget Chat widget UI and embed functionality

Projects

Development

Successfully merging this pull request may close these issues.

Mobile responsive layout with full-screen bottom sheet

1 participant