Skip to content

[select] Fix RTL aligned popup positioning - #4531

Merged
atomiks merged 13 commits into
mui:masterfrom
atomiks:codex/select-rtl-align-item-with-trigger
Apr 8, 2026
Merged

atomiks merged 13 commits into
mui:masterfrom
atomiks:codex/select-rtl-align-item-with-trigger

Conversation

@atomiks

@atomiks atomiks commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

This fixes Select.Positioner with alignItemWithTrigger in RTL by aligning the popup against the selected value's logical inline edge instead of always using physical left-edge math. This caused the select to not be aligned perfectly on the x-axis.

https://deploy-preview-4531--base-ui.netlify.app/experiments/select-rtl-align-item-with-trigger

Changes

  • Use the current text direction when computing the aligned popup offset in Select.Popup.
  • Preserve the existing viewport clamping behavior after the logical-edge alignment step.
  • Add real-browser regression coverage for both LTR and RTL selected-item alignment.

@atomiks atomiks added type: bug It doesn't behave as expected. component: select Changes related to the select component. labels Apr 6, 2026 — with ChatGPT Codex Connector
@pkg-pr-new

pkg-pr-new Bot commented Apr 6, 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@4531
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@4531
    

commit: 995d0b2

@mui-bot

mui-bot commented Apr 6, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+36B(+0.01%) 🔺+26B(+0.02%)

Details of bundle changes


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

@netlify

netlify Bot commented Apr 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 995d0b2
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69d5edd7c037fa000852b6c7
😎 Deploy Preview https://deploy-preview-4531--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 April 6, 2026 07:11
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 6, 2026
…align-item-with-trigger

# Conflicts:
#	packages/react/src/select/item/SelectItem.tsx
#	packages/react/src/select/popup/SelectPopup.tsx
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 7, 2026

atomiks commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor Author

Codex Review (GPT-5.4)

Reviewed the latest PR head da8ddd4 against a freshly fetched upstream/master. Dominant type: bug-fix with tests and react-ui secondary tags. This is a follow-up pass after Claude's review, so I focused on the geometry and regression gaps raised there rather than rehashing the original RTL fix.

1. Bugs / Issues (None)

Root Cause & Patch Assessment

The RTL inline-edge fix still looks correct on the latest head. The measurement path waits for Floating UI's first positioning pass, keeps the selected item text available on first open, and preserves the existing viewport clamp / fallback model.

Claude's remaining notes about the clamp behavior change and the flushSync removal still look non-blocking to me on the current branch. The clamp change is consistent with the newer logical-edge positioning, and the fallback state update still runs from layout effect before paint.

Test Coverage Assessment

Claude's test-gap points were useful, and the latest commit addresses the actionable ones:

  • added a real-browser regression case where popup-level padding and border shift the selected text in LTR
  • added a no-value RTL case to cover first-open alignment when the first item becomes the measurement target
  • removed the stray async flush from the RTL regression and cleaned up the Y-offset naming / comments

I also re-ran:

  • pnpm prettier
  • pnpm test:jsdom SelectPopup --no-watch
  • pnpm test:chromium SelectPopup --no-watch

All passed locally.

Branch Status

The latest PR head is da8ddd4, and the GitHub checks for that commit are still pending at the time of this comment (CircleCI matrix plus Netlify).

Recommendation

Approve ✅

I don't see a remaining actionable code-review issue on the latest head. Claude's main testing concerns are now covered by the follow-up commit, and the branch looks ready pending CI on da8ddd4.

@atomiks
atomiks merged commit ec42181 into mui:master Apr 8, 2026
7 checks passed
@atomiks
atomiks deleted the codex/select-rtl-align-item-with-trigger branch April 8, 2026 06:00
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.

2 participants