vercel / vercel/ai-elements

MessageContent: replace overflow-hidden with overflow-x-clip to preserve sticky positioning

Open Beginner friendly
#420 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
283
Avg merge
32m
Merged PRs (30d)
1

Description

Description

`MessageContent` currently uses `overflow-hidden` on its root div. Per CSS spec, `overflow: hidden` creates a scroll container, which breaks `position: sticky` for any descendants (e.g., code block action buttons rendered by streamdown or similar markdown renderers).

Proposal

Replace `overflow-hidden` with `overflow-x-clip` on the `MessageContent` root div.

Why `overflow-x-clip`?
  • `overflow: clip` does not create a scroll container (unlike `overflow: hidden`), so `sticky` positioning continues to work for descendants
  • It still clips wide content (long URLs, inline code) from overflowing the message bubble horizontally
  • `overflow-x-clip` specifically targets the horizontal axis, leaving vertical overflow unaffected
Suggested change

```diff

  • "... overflow-hidden text-sm",
  • "... overflow-x-clip text-sm",
    ```

Context

We discovered this while debugging unclickable code block buttons in a chat UI. While the root cause turned out to be a separate issue with `sticky` + `pointer-events-none` in nested scroll containers, the `overflow-hidden` → `overflow-x-clip` change is independently valuable as a layout improvement that preserves sticky positioning for any future descendants that need it.

Browser support

`overflow: clip` is supported in all modern browsers (Chrome 90+, Firefox 81+, Safari 16+).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the MessageContent component and inspect the class list on its root div. Replace the horizontal overflow utility as proposed, then verify that wide content remains clipped while sticky descendants are no longer made sticky-ineligible by overflow-hidden.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, tailwindcss, typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.