Skip to content
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

feat(Modal): add launcherButtonRef prop to handle focus on close #14355

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

tw15egan
Copy link
Collaborator

Closes #13680

Adds a new launcherButtonRef to Modal and ComposedModal. This allows a user to pass in a ref to the button that is used to launch the Modal

Changelog

New

  • launcherButtonRef prop added to Modal / ComposedModal.

Changed

  • Updated the state manager stories to use the new launcherButtonRef prop to handle focus returning to the button when the Modal / ComposedModal is closed

Testing / Reviewing

Ensure focus returns to the button when closing either Modal / ComposedModal via keyboard or mouse click

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 0ccffe8
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/64c81da4376c090008a8ceeb
😎 Deploy Preview https://deploy-preview-14355--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Jul 31, 2023

Deploy Preview for carbon-components-react ready!

Name Link
🔨 Latest commit 0ccffe8
🔍 Latest deploy log https://app.netlify.com/sites/carbon-components-react/deploys/64c81da43f96a200081a6e89
😎 Deploy Preview https://deploy-preview-14355--carbon-components-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@andreancardona andreancardona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the AVT test failing - looks good. I wonder if we can just specify that test to get it to pass?

@tw15egan
Copy link
Collaborator Author

@andreancardona updated the tests to account for the new behavior

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating both Modal and ComposedModal 👍

@github-actions github-actions bot added this pull request to the merge queue Jul 31, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 31, 2023
@tw15egan tw15egan added this pull request to the merge queue Jul 31, 2023
Merged via the queue into carbon-design-system:main with commit 35fc72f Jul 31, 2023
@tw15egan tw15egan deleted the modal-focus branch July 31, 2023 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[a11y]: Modal: doesn't return focus properly on dismissal
3 participants