Skip to content

Fix: Resolve mobile scrolling issue in chat view#300

Merged
ngoiyaeric merged 1 commit into
mainfrom
fix-mobile-scrolling
Sep 29, 2025
Merged

Fix: Resolve mobile scrolling issue in chat view#300
ngoiyaeric merged 1 commit into
mainfrom
fix-mobile-scrolling

Conversation

@ngoiyaeric
Copy link
Copy Markdown
Collaborator

@ngoiyaeric ngoiyaeric commented Sep 29, 2025

User description

This commit addresses a scrolling problem on mobile devices where the chat message area would not scroll, preventing users from seeing the latest messages.

The root cause was the use of overflow: hidden on the body element in combination with a flexbox layout for the mobile view. This prevented the chat message container from expanding and scrolling as intended.

The fix involves two CSS changes:

  1. Removed overflow: hidden from the body style in app/globals.css.
  2. Added min-height: 0 to the .mobile-chat-messages-area style. This allows the flex item to shrink correctly within the flex container, enabling overflow-y: auto to function properly.

PR Type

Bug fix


Description

  • Remove overflow: hidden from body element

  • Add min-height: 0 to mobile chat messages area

  • Fix mobile scrolling in chat view


Diagram Walkthrough

flowchart LR
  A["Body element"] -- "Remove overflow: hidden" --> B["Enable scrolling"]
  C["Mobile chat area"] -- "Add min-height: 0" --> D["Proper flex shrinking"]
  B --> E["Fixed mobile chat scrolling"]
  D --> E
Loading

File Walkthrough

Relevant files
Bug fix
globals.css
Fix mobile chat scrolling CSS properties                                 

app/globals.css

  • Remove overflow: hidden from body element styling
  • Add min-height: 0 to .mobile-chat-messages-area class
+1/-1     

Summary by CodeRabbit

  • Bug Fixes
    • Restored full-page vertical scrolling to prevent content from being clipped, improving readability for long pages and smoother navigation.
    • Improved mobile chat message area sizing to prevent unintended growth in flex layouts, reducing layout shifts and keeping messages consistently scrollable.
    • Enhances stability across devices and screen sizes, providing a more reliable viewing experience for long conversations and pages.

This commit addresses a scrolling problem on mobile devices where the chat message area would not scroll, preventing users from seeing the latest messages.

The root cause was the use of `overflow: hidden` on the `body` element in combination with a flexbox layout for the mobile view. This prevented the chat message container from expanding and scrolling as intended.

The fix involves two CSS changes:
1.  Removed `overflow: hidden` from the `body` style in `app/globals.css`.
2.  Added `min-height: 0` to the `.mobile-chat-messages-area` style. This allows the flex item to shrink correctly within the flex container, enabling `overflow-y: auto` to function properly.
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Sep 29, 2025

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

Project Deployment Preview Comments Updated (UTC)
qcx Ready Ready Preview Comment Sep 29, 2025 7:30am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 29, 2025

Walkthrough

Updated CSS in app/globals.css: removed overflow clipping on body and set min-height: 0 for .mobile-chat-messages-area.

Changes

Cohort / File(s) Summary of changes
CSS layout tweaks
app/globals.css
Removed overflow: hidden from body; added min-height: 0 to .mobile-chat-messages-area to adjust flex container behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • fix: Allow mobile chat to scroll #242 — Also modifies app/globals.css to address mobile chat scrolling by removing overflow clipping and setting min-height: 0, targeting the same issue.

Suggested labels

Review effort 2/5

Poem

I nudge the styles with a gentle thrum,
Let pages breathe where once felt numb.
Min-heights set, scrolls freely run—
A bunny taps, “This CSS is done.”
Hop, hop, hooray! The layout’s fun. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely and clearly describes the primary change—fixing the mobile scrolling issue within the chat view—directly reflecting the CSS adjustments for overflow and min-height in the PR.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-mobile-scrolling

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a822551 and 2375750.

📒 Files selected for processing (1)
  • app/globals.css (1 hunks)
🔇 Additional comments (1)
app/globals.css (1)

153-161: Good fix: allow the flex child to scroll.

Adding min-height: 0 on the scrollable flex item is the right fix for the iOS/Chrome mobile flexbox overflow trap. LGTM.

Please confirm the immediate parent of .mobile-chat-messages-area has display: flex; flex-direction: column; and no max-height constraints, so this child can actually shrink.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Layout Regression

Removing body-level overflow: hidden may re-enable page scroll behind modals, drawers, or fixed overlays on mobile. Validate modal/overlay interactions and ensure body scroll locking is handled where needed.

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  margin: 0;
  padding: 0;
  height: 100vh;
}
Flex Overflow

Verify that adding min-height: 0 on .mobile-chat-messages-area doesn’t cause the area to collapse in edge cases (e.g., when siblings have fixed heights or when virtual keyboards resize the viewport). Confirm expected scrolling with long content.

.mobile-chat-messages-area {
  flex: 1; /* Changed from height: 40vh to take available space */
  overflow-y: auto;
  padding: 12px;
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-sizing: border-box;
  min-height: 0;
}

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qodo-code-review
Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link
Copy Markdown

@charliecreates charliecreates Bot left a comment

Choose a reason for hiding this comment

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

The changes fix the mobile scrolling issue, but removing overflow: hidden from body may reintroduce unwanted horizontal/background scrolling. Also, the messages area could benefit from overscroll-behavior and iOS momentum scrolling for a more robust mobile UX. No logic or performance regressions are evident beyond these potential UX concerns.

Additional notes (1)
  • Compatibility | app/globals.css:160-160
    Good addition. To further improve mobile scroll behavior, consider preventing scroll chaining (body scroll when the inner area hits boundaries) and enabling momentum scrolling on iOS. This hardens the fix for mobile UX without changing layout.
Summary of changes
  • Removed overflow: hidden from the body in app/globals.css to allow scrolling on mobile.
  • Added min-height: 0 to .mobile-chat-messages-area to ensure the flex child can shrink and enable overflow-y: auto to work as intended.

These changes target the mobile chat layout to fix the non-scrolling messages area.

Comment thread app/globals.css
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Removing overflow: hidden from body resolves the flexbox scrolling issue, but it also re-enables page-level scrolling. This can introduce regressions such as horizontal scrollbars (if any content overflows horizontally) and background scrolling behind modals/drawers. Consider explicitly preventing horizontal scroll at the body level while allowing vertical scroll to keep the fix scoped and avoid unintended side effects.

Suggestion

You can keep the vertical scrolling fix while preventing accidental horizontal scrollbars by setting:

body {
  /* keep existing properties */
  overflow-x: hidden;
  overflow-y: auto;
}

Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this change.

@charliecreates charliecreates Bot removed the request for review from CharlieHelps September 29, 2025 07:30
@ngoiyaeric ngoiyaeric merged commit a27be03 into main Sep 29, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants