Skip to content

[select] Fix support for max-height popup style when alignItemWithTrigger is active#3573

Merged
atomiks merged 7 commits into
mui:masterfrom
atomiks:fix/select-max-height
Jan 15, 2026
Merged

[select] Fix support for max-height popup style when alignItemWithTrigger is active#3573
atomiks merged 7 commits into
mui:masterfrom
atomiks:fix/select-max-height

Conversation

@atomiks

@atomiks atomiks commented Dec 18, 2025

Copy link
Copy Markdown
Contributor

Built off #3532. Specifying max-height on .Popup is now respected without the popup moving while scrolling.

https://stackblitz.com/edit/dzf17jwn

Fixes #3396

@atomiks atomiks added component: select Changes related to the select component. type: bug It doesn't behave as expected. labels Dec 18, 2025
@pkg-pr-new

pkg-pr-new Bot commented Dec 18, 2025

Copy link
Copy Markdown
  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@3573
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3573
    

commit: 8ed70d8

@mui-bot

mui-bot commented Dec 18, 2025

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+116B(+0.03%) 🔺+58B(+0.04%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Dec 18, 2025

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 8ed70d8
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/696866886347460008ab4117
😎 Deploy Preview https://deploy-preview-3573--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks marked this pull request as ready for review December 18, 2025 08:06
Signed-off-by: atomiks <cc.glows@gmail.com>
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Dec 30, 2025
Signed-off-by: atomiks <cc.glows@gmail.com>
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Dec 30, 2025
@atomiks atomiks mentioned this pull request Jan 13, 2026
1 task
const positionerStyles = getComputedStyle(positionerElement);
const marginTop = parseFloat(positionerStyles.marginTop);
const marginBottom = parseFloat(positionerStyles.marginBottom);
const maxPopupHeight = getMaxPopupHeight(popupRef.current);

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.

This calls getComputedStyle every frame when scrolling. How about calling this when scroll starts, caching the value and clearing the cache onScrollEnd?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That was already being done with positionerStyles though. Also Floating UI does the same when scrolling - I don't think it's a concern

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.

It's not really a concern, just an opportunity to save some CPU cycles.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alright - this can be done in a separate PR as it was already the case in the code previously for the positioner element

@LukasTy LukasTy left a comment

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.

Outside of the mentioned improvement concern, LGTM. 👍

@atomiks atomiks merged commit 8403531 into mui:master Jan 15, 2026
23 checks passed
@atomiks atomiks deleted the fix/select-max-height branch January 15, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: select Changes related to the select component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[select] Glitchy alignItemWithTrigger behavior when Popup has max-height

4 participants