Skip to content

fix(ui): prevent double vertical scrollbars in latex math rendering#2967

Open
Siddhu2k04 wants to merge 1 commit into
Chainlit:mainfrom
Siddhu2k04:fix/2949-latex-double-scrollbar
Open

fix(ui): prevent double vertical scrollbars in latex math rendering#2967
Siddhu2k04 wants to merge 1 commit into
Chainlit:mainfrom
Siddhu2k04:fix/2949-latex-double-scrollbar

Conversation

@Siddhu2k04

@Siddhu2k04 Siddhu2k04 commented Jun 19, 2026

Copy link
Copy Markdown

Fix duplicate vertical scrollbar when LaTeX rendering is enabled

Summary

This PR fixes an issue where enabling latex=true in config.toml could cause two vertical scrollbars to appear in the chat UI when rendering LaTeX content.

Root Cause

The chat interface already provides a scrollable container for messages. When LaTeX content is rendered, the math wrapper may introduce additional overflow behavior, creating a nested scroll container and resulting in duplicate vertical scrollbars.

Changes

  • Removed unnecessary vertical overflow handling from LaTeX rendering containers.

  • Restricted LaTeX elements to horizontal scrolling only when needed.

  • Ensured the main chat container remains the sole vertical scroll region.

  • Preserved existing LaTeX rendering behavior and layout.

Before

  • latex=true enabled.

  • Sending multiple messages containing LaTeX equations eventually displays two vertical scrollbars.

After

  • Only one vertical scrollbar is displayed.

  • LaTeX equations render correctly.

  • Normal chat scrolling behavior remains unchanged.

Testing

Reproduction Steps

  1. Enable latex=true in config.toml.

  2. Run the following application:

import chainlit as cl

@cl.on_message
async def main(message: cl.Message):
await cl.Message(
content="Here is the quadratic formula:\n$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$"
).send()

  1. Start Chainlit.

  2. Send messages multiple times until the chat becomes scrollable.

Results

Scenario Result
Before Fix Two vertical scrollbars appear
After Fix Only one vertical scrollbar appears
WhatsApp Image 2026-06-19 at 7 42 58 AM

References

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working frontend Pertains to the frontend. labels Jun 19, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

@Siddhu2k04

Copy link
Copy Markdown
Author

Hi @asvishnyakov and @sandangel,

I've submitted a fix for #2949 and verified that it resolves the duplicate vertical scrollbar issue when LaTeX rendering is enabled.

Could you please review the PR when you have a chance? Any feedback is appreciated.

Thanks! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend Pertains to the frontend. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI displays two vertical scrollbars with enabled latex rendering

1 participant