Skip to content

[popups] Fix auto-resize origin for left-anchored popups - #5370

Merged
atomiks merged 9 commits into
mui:masterfrom
sai6855:anchor-fix
Jul 30, 2026
Merged

atomiks merged 9 commits into
mui:masterfrom
sai6855:anchor-fix

Conversation

@sai6855

@sai6855 sai6855 commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Left-anchored popups fell through the isOriginSide gate, so they never got the right: 0 pin and resized/animated from the wrong edge (every other side was handled).

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

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

commit: 608174e

@sai6855 sai6855 changed the title [popup] Refactor anchoring styles and add tests for getPopupAnchoringStyles [popover] Fix auto-resize origin for left-anchored popups Jul 29, 2026
@sai6855 sai6855 changed the title [popover] Fix auto-resize origin for left-anchored popups [popover] Fix auto-resize origin for left-anchored popups Jul 29, 2026
@sai6855
sai6855 requested a review from Copilot July 29, 2026 10:08
@sai6855 sai6855 added type: bug It doesn't behave as expected. component: popover Changes related to the popover component. labels Jul 29, 2026
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit da5f1d3
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a69d080d594cf0008d079cf
😎 Deploy Preview https://deploy-preview-5370--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-38B(-0.01%) ▼-5B(0.00%)

Details of bundle changes

Performance

Total duration: 1,122.65 ms -211.65 ms(-15.9%) | Renders: 78 (+0) | Paint: 1,755.54 ms -337.28 ms(-16.1%)

Test Duration Renders
Menu mount (300 instances) 115.17 ms ▼-52.54 ms(-31.3%) 2 (+0)
Select mount (200 instances) 136.61 ms ▼-48.75 ms(-26.3%) 3 (+0)
Menu open (500 items) 59.40 ms ▼-23.24 ms(-28.1%) 12 (+0)
Mixed surface mount (app-like density) 60.46 ms ▼-22.40 ms(-27.0%) 5 (+0)
Combobox open — 500 items 33.15 ms ▼-21.89 ms(-39.8%) 4 (+0)

…and 3 more (+7 within noise) — details


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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes popup auto-resize anchoring so left-anchored (including logical-to-physical-left) popups get the same “grow toward the anchor” pinning behavior as the already-handled top case.

Changes:

  • Update the anchoring-style gate to include physical-left anchoring.
  • Add a new unit test intended to validate the anchoring-style mapping across LTR/RTL and logical sides.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/utils/usePopupAutoResize.ts Extends the anchoring-styles condition to cover physical-left popups so width transitions pin to the correct edge.
packages/react/src/utils/usePopupAutoResize.test.ts Adds tests for physical-left and logical-side mapping, but currently imports a helper that isn’t exported/defined.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,40 @@
import { expect } from 'vitest';
import { getPopupAnchoringStyles } from './usePopupAutoResize';
@netlify

netlify Bot commented Jul 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 038629e
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a69d103dfa62b0008f3e4b0
😎 Deploy Preview https://deploy-preview-5370--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

packages/react/src/utils/usePopupAutoResize.ts:205

  • isOriginSide currently duplicates the same logical-side checks as isPhysicalLeft, but its value is only used in the final return condition. This makes the branching harder to reason about (and easy to accidentally change incorrectly later). You can simplify by deriving isPhysicalLeft from side/direction once and then using side === 'top' || isPhysicalLeft as the condition.
  let isOriginSide = side === 'top';
  let isPhysicalLeft = side === 'left';
  if (direction === 'rtl') {
    isOriginSide = isOriginSide || side === 'inline-end';
    isPhysicalLeft = isPhysicalLeft || side === 'inline-end';
  } else {
    isOriginSide = isOriginSide || side === 'inline-start';
    isPhysicalLeft = isPhysicalLeft || side === 'inline-start';
  }

@netlify

netlify Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 608174e
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a6a9507c848720008be4484
😎 Deploy Preview https://deploy-preview-5370--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@sai6855
sai6855 marked this pull request as ready for review July 29, 2026 12:25
@atomiks atomiks added scope: all components Widespread work has an impact on almost all components. and removed component: popover Changes related to the popover component. labels Jul 30, 2026
@atomiks atomiks changed the title [popover] Fix auto-resize origin for left-anchored popups [popups] Fix auto-resize origin for left-anchored popups Jul 30, 2026
@atomiks
atomiks merged commit 692bc87 into mui:master Jul 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: all components Widespread work has an impact on almost all components. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants