-
-
Notifications
You must be signed in to change notification settings - Fork 489
fix: spaceKey preventDefault #1203
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
|
@QDyanbing 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 @QDyanbing, 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! 此拉取请求旨在解决 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. Changelog
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修改 BaseSelect 的键盘处理:在 onInternalKeyDown 中,当事件目标为输入元素时,Enter/Space 的 preventDefault 不再被无差别阻止;仅在非 combobox 且不在输入框内时阻止默认行为。还新增了示例文档与演示代码文件。 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
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)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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
The pull request correctly addresses the issue of event.preventDefault() being called for the space key, as described in the linked issue. By modifying the condition to include isEnterKey, the default behavior for the space key is no longer prevented in this specific block, which aligns with the stated goal of the fix.
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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/BaseSelect/index.tsx (1)
472-482:⚠️ Potential issue | 🟠 Major单选模式下 Space 键仍需阻止默认滚动行为
移除 Space 键的
preventDefault修复允许在搜索模式下输入空格,但造成回归:在单选且无搜索的 Select 上按 Space 会导致页面滚动。标准 ARIA 行为要求 Space 打开下拉时应防止页面滚动。建议根据是否处于搜索输入状态有条件地调用 preventDefault:
if (isEnterKey || isSpaceKey) { // Do not submit form when type in the input; prevent Space from scrolling page - if (isEnterKey && mode !== 'combobox') { + if (mode !== 'combobox') { + if (isEnterKey) { + event.preventDefault(); + } + // Prevent Space from scrolling page when not actively searching + if (isSpaceKey && !mergedSearchValue) { + event.preventDefault(); + } }
fix: ant-design/ant-design#56939
isSpaceKey 去除 event.preventDefault()
Summary by CodeRabbit
发布说明
Bug Fixes
New Features