-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Fix/modal autofocus close button #11425
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: main
Are you sure you want to change the base?
Fix/modal autofocus close button #11425
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
WalkthroughThis change introduces a new optional callback prop Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 3 warnings)
✅ Passed checks (3 passed)
✨ 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 |
Cristhianzl
left a 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.
lgtm
b57a783 to
b1fbb3b
Compare
Summary
When the
SaveChangesModalandFlowLogsModalopen, the Close button was receiving auto-focus by default, which created a visually distracting experience - the highlighted Close button drew too much attention and felt cluttered.In the
FlowLogsModal, this behavior was especially noticeable when the table was empty or didn't have enough data to require scrolling.To maintain accessibility without breaking it entirely (see radix-ui/primitives#935), the focus was redirected to the primary action button instead of removing focus completely.
Changes
baseModal/index.tsx: AddedonOpenAutoFocusprop support to pass to DialogContentflowLogsModal/index.tsx: AddedonOpenAutoFocushandler to redirect focus to the close buttonsaveChangesModal/index.tsx: AddedonOpenAutoFocushandler to redirect focus to the "Save" buttonconfirmationModal/index.tsx: Added support foronOpenAutoFocusproptypes/components/index.ts: AddedonOpenAutoFocustype definitionEvidence
FlowLogsModal
Before
Log.btn.focus.mov
After
Log.btn.no.focus.mov
SaveLogsModal
Before
Save.btn.focus.mov
After
Save.btn.no.focus.mov
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.