-
-
Notifications
You must be signed in to change notification settings - Fork 488
feat: add disableAutoScroll prop to control auto-scrolling behavior in the select component #1197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
@aeifn is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Summary of ChangesHello @aeifn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Walkthrough为 Select 组件新增公开布尔属性 Changes
Sequence Diagram(s)sequenceDiagram
participant App as 应用 (传入 prop)
participant Select as Select 组件
participant Context as SelectContext
participant OptionList as OptionList 组件
App->>Select: 传入 disableAutoScroll (true/false)
Select->>Context: 将 disableAutoScroll 写入 context
OptionList->>Context: 读取 selected / options / disableAutoScroll
alt disableAutoScroll = false
OptionList->>OptionList: 自动滚动至单项
else disableAutoScroll = true
OptionList-->>OptionList: 跳过自动滚动
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
庆祝诗
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a disableAutoScroll prop to give users control over the automatic scrolling behavior in the Select component. The changes are well-implemented, adding the prop and threading it down to the OptionList component where it's used to conditionally enable the auto-scroll logic. The documentation has also been updated accordingly. I have one suggestion regarding a potential bug with stale data in a useEffect hook due to a missing dependency, which was a pre-existing issue exacerbated by this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@README.md`:
- Line 125: 文档中关于属性 disableAutoScroll 的说明不够明确,请在 README
的该属性行(disableAutoScroll)后补充一句说明其仅在单选模式下生效,且不会影响多选或带搜索的场景,以避免误解;定位到 README 中表格里包含
disableAutoScroll 的那一行,更新描述文本为“Disable auto scroll to selected option — only
applies to single-select mode; does not affect multi-select or searchable
scenarios.”
…t and searchable scenarios in README.
The disableAutoScroll prop provides users with control over the automatic scrolling behavior in single-select
mode. By default, the Select component automatically scrolls to the selected option when the dropdown opens,
which can be disruptive in certain UX scenarios where users want to maintain their current scroll position or
handle scrolling manually.
This addition allows developers to disable the auto-scroll behavior while preserving all other functionality.
Summary by CodeRabbit
新增功能
文档
✏️ Tip: You can customize this high-level summary in your review settings.