Skip to content

fix(select): use overflowX/overflowY instead of overflow shorthand in Viewport#3927

Open
LongTangGithub wants to merge 1 commit into
radix-ui:mainfrom
LongTangGithub:fix/select-viewport-overflow-shorthand
Open

fix(select): use overflowX/overflowY instead of overflow shorthand in Viewport#3927
LongTangGithub wants to merge 1 commit into
radix-ui:mainfrom
LongTangGithub:fix/select-viewport-overflow-shorthand

Conversation

@LongTangGithub

Copy link
Copy Markdown

Closes #2059

Description

Select.Viewport was setting overflow: 'hidden auto' as a CSS shorthand.

When a ScrollArea is composed inside Select.Content (as shown in the Radix docs), ScrollArea.Viewport sets overflowX and overflowY as separate longhand properties.

React detects this as a conflict between a shorthand and longhands on the same element during re-render and logs a warning:

Warning: Updating a style property during rerender (overflowY) when a conflicting property is set (overflow). To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.

Fix

  • Replace the overflow shorthand in Select.Viewport with explicit overflowX: 'hidden' and overflowY: 'auto' longhand properties.

  • This matches how ScrollArea.Viewport already sets its own overflow styles and eliminates the conflict.

Manual Testing

A new Storybook story WithScrollArea has been added to reproduce this scenario. To verify:

  1. Run pnpm dev and open Components/Select → WithScrollArea
  2. Switch your DevTools console context to storybook-preview-iframe
  3. Before fix: open the Select dropdown — the console shows a React style conflict warning
  4. After fix: open the Select dropdown — no warning appears in the console

Screenshot of Fix

no-console-warning

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 36b4a37

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@radix-ui/react-select Patch
radix-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

);

export const WithScrollArea = () => {
<div style={{ padding: 50 }}>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You aren't actually returning the JSX here so this story renders nothing.

"@radix-ui/react-select": patch
---

Fix React warning when composing ScrollArea inside Select by replacing overflow shorthand with overflowX/overflowY longhand properties in Select.Viewport

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Fix React warning when composing ScrollArea inside Select by replacing overflow shorthand with overflowX/overflowY longhand properties in Select.Viewport
Fixed React warning when composing ScrollArea inside Select due to conflicting inline `overflow` styles

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.

ScrollArea inside a Select generates overflow warnings

2 participants