Skip to content

fix: horizontal scroll for suggestion chips on mobile#26

Merged
rupurt merged 1 commit intomainfrom
mobile-chips-scroll
Dec 25, 2025
Merged

fix: horizontal scroll for suggestion chips on mobile#26
rupurt merged 1 commit intomainfrom
mobile-chips-scroll

Conversation

@rupurt
Copy link
Copy Markdown
Contributor

@rupurt rupurt commented Dec 25, 2025

Summary

  • Suggestion chips now scroll horizontally on mobile instead of wrapping to multiple lines
  • Keeps flex-wrap behavior on desktop (sm: breakpoint and up)
  • Adds scrollbar-hide utility to hide scrollbar on iOS/Android while keeping scroll functionality

Problem

On iOS, the wrapped suggestion chips took up too much vertical space, making it hard to see the message thread.

Solution

Use the common mobile messaging pattern of horizontal scrolling for quick replies (like iMessage/WhatsApp).

Test Plan

  • All unit tests pass
  • Manual test on iOS - chips should scroll horizontally
  • Manual test on desktop - chips should wrap normally

- Change from flex-wrap to horizontal scroll on mobile
- Keep flex-wrap behavior on desktop (sm: breakpoint)
- Add scrollbar-hide utility to hide scrollbar on iOS/Android
- Add whitespace-nowrap and shrink-0 to prevent chip text wrapping
Copilot AI review requested due to automatic review settings December 25, 2025 00:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the mobile user experience by implementing horizontal scrolling for suggestion chips instead of vertical wrapping, following common messaging app patterns like iMessage and WhatsApp.

Key Changes:

  • Added horizontal scrolling behavior for suggestion chips on mobile devices
  • Maintained flex-wrap behavior for desktop viewports (sm breakpoint and above)
  • Introduced a custom scrollbar-hide utility class to hide scrollbars while preserving scroll functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/styles/global.css Added scrollbar-hide utility class to hide scrollbars across browsers while maintaining scroll functionality
src/features/chat/components/SuggestionChips.tsx Modified container and button styling to enable horizontal scrolling on mobile with whitespace and shrink controls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<div className={cn('flex flex-wrap gap-2', className)}>
<div
className={cn(
'flex gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-hide',
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

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

The negative margin pattern (pb-1 -mb-1) is used to hide the scrollbar space, but this approach can be fragile and may cause layout issues with parent containers. Consider using overflow-x-auto scrollbar-hide without the padding/margin trick, as the scrollbar-hide class should already handle hiding the scrollbar without requiring layout adjustments.

Suggested change
'flex gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-hide',
'flex gap-2 overflow-x-auto scrollbar-hide',

Copilot uses AI. Check for mistakes.
className={cn(
'flex gap-2 overflow-x-auto pb-1 -mb-1 scrollbar-hide',
// Wrap on desktop, scroll on mobile
'sm:flex-wrap',
Copy link

Copilot AI Dec 25, 2025

Choose a reason for hiding this comment

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

The desktop wrapping behavior restores at sm breakpoint (typically 640px), but this may be too early for tablets in portrait mode. Consider using md:flex-wrap (768px) instead to ensure a better experience on tablet devices, which would benefit more from the horizontal scroll pattern.

Suggested change
'sm:flex-wrap',
'md:flex-wrap',

Copilot uses AI. Check for mistakes.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
vibes-website 2ec19f6 Commit Preview URL

Branch Preview URL
Dec 25 2025, 12:48 AM

@rupurt rupurt merged commit a93faf9 into main Dec 25, 2025
3 checks passed
@rupurt rupurt deleted the mobile-chips-scroll branch December 25, 2025 00:52
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.

2 participants