Prevent scroll on focus for matched element#726
Prevent scroll on focus for matched element#726zombieJ merged 1 commit intoreact-component:masterfrom
Conversation
Update focus behavior to prevent scrolling when focusing an element.
|
@cactuser-Lu 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 @cactuser-Lu, 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 addresses an issue where focusing an element could cause the page to scroll unexpectedly. By updating the focus mechanism to explicitly prevent scrolling, it improves the user experience by maintaining the current scroll position when an element programmatically receives focus, aligning with the reported bug fix. 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
Activity
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
|
走查修改了 变更
预估代码审查工作量🎯 1 (简单) | ⏱️ ~3 分钟 诗
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. 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 introduces a targeted fix to prevent the page from scrolling when an element is programmatically focused as part of the focus-locking mechanism. The change adds the { preventScroll: true } option to the focus() call in syncFocus, which is the correct approach to solve this issue. This improves user experience by preventing unexpected layout shifts. The change is correct and has no side effects.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #726 +/- ##
=======================================
Coverage 85.98% 85.98%
=======================================
Files 38 38
Lines 1020 1020
Branches 380 380
=======================================
Hits 877 877
Misses 141 141
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Update focus behavior to prevent scrolling when focusing an element.
fix: ant-design/ant-design#56798
Summary by CodeRabbit
Bug Fixes