Skip to content

fix(elements): keep branch switching with consumer className - #465

Open
ephraimduncan wants to merge 1 commit into
vercel:mainfrom
ephraimduncan:fix/message-branch-content-classname
Open

fix(elements): keep branch switching with consumer className#465
ephraimduncan wants to merge 1 commit into
vercel:mainfrom
ephraimduncan:fix/message-branch-content-classname

Conversation

@ephraimduncan

Copy link
Copy Markdown

Passing any className to MessageBranchContent made every branch render at once, so the Previous/Next controls stopped producing a visible change. The consumer class sat in the props spread after the component's computed className, replacing the hidden/block state classes entirely. Even without a consumer class, tailwind-merge collapsed the conflicting grid/block utilities to block, so the active branch never got its intended grid layout.

The wrapper now derives display from a single state-dependent utility (grid when active, hidden otherwise) placed after the consumer class in cn(), so branch visibility always wins the merge while consumer classes still extend the wrapper. Trade-off: a consumer can no longer override the active branch's display type.

Regression test renders two branches with className="rounded-md" and asserts exactly one wrapper is grid before and after clicking Next; full message suite passes 31/31 in Chromium.

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@ephraimduncan is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant