-
Notifications
You must be signed in to change notification settings - Fork 538
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
Add support for initial focus ref to Dialog 2 #4729
Conversation
🦋 Changeset detectedLatest commit: 2c9eca0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
@@ -4,7 +4,7 @@ import {render as HTMLRender, fireEvent} from '@testing-library/react' | |||
import axe from 'axe-core' | |||
import {behavesAsComponent, checkExports} from '../utils/testing' | |||
|
|||
/* Dialog Version 2 */ | |||
/* Dialog Version 1*/ |
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.
if you say so 😅😅😅
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.
This is getting out of our hand now 🤣 I think version 2 tests are this : https://github.com/primer/react/blob/main/packages/react/src/Dialog/Dialog.test.tsx
Confirmed with looking at the APIs as well - I hope we get it right this time 😅 🤞🏻
👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/332713 |
This reported internally and lack of being able to focus on a specific element when the dialog is open is problematic for some teams. This PR adds support for an
initialFocusRef
prop to the Dialog component. (As same as Dialog 1, although parity wasn't the motivation.)Note
We thought about using the native
autoFocus
attribute however, there is a known bug about using it in React. We also not sure about our timeline of switching to native dialog, we decided to stick with the current implementation. Let me know if you have any concerns 🙌🏻Changelog
New
initialFocusRef
prop. This prop allows you to specify an element that should receive focus when the dialog opens.Rollout strategy
Testing & Reviewing
Merge checklist