fix: preserve min width for numeric popup width#1228
Conversation
|
@QDyanbing is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Walkthrough调整了 ChangesSelect 弹层宽度处理
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/SelectTrigger.tsxESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. tests/Select.test.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the stretch calculation in SelectTrigger.tsx to return 'minWidth' instead of null when popupMatchSelectWidth is a number. It also adds a test case in tests/Select.test.tsx to verify that the dropdown menu width is not smaller than the trigger when popupMatchSelectWidth is configured as a number. I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1228 +/- ##
==========================================
- Coverage 99.44% 99.44% -0.01%
==========================================
Files 31 31
Lines 1265 1263 -2
Branches 441 440 -1
==========================================
- Hits 1258 1256 -2
Misses 7 7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
背景
popupMatchSelectWidth传入 number 时,历史行为和文档语义都是下拉框宽度不应小于触发器宽度,即实际宽度应为max(popupMatchSelectWidth, triggerWidth)。在使用
@rc-component/trigger的stretch逻辑后,number 场景会跳过 stretch,只保留width: popupMatchSelectWidth,导致当传入值小于选择器宽度时,下拉框会被固定成更窄的宽度。修改
stretch设置为minWidth,让 trigger 继续补充触发器宽度作为最小宽度。width: popupMatchSelectWidth,因此传入值大于触发器宽度时仍按自定义宽度展示。popupMatchSelectWidth为 number 且小于触发器宽度的场景。验证
npm test -- tests/Select.test.tsxnpm test -- tests/Select.test.tsx -t "dropdownMatchSelectWidth"npm run tscnpm run lint(仅存在既有 warning,无 error)Summary by CodeRabbit