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

fix(modals): provide ref object for focusvisible #887

Merged
merged 1 commit into from
Sep 22, 2020
Merged

Conversation

hzhu
Copy link
Contributor

@hzhu hzhu commented Sep 22, 2020

Description

It was recently discovered that focusvisible behavior broke within modal components.

Detail

It looks like the environment changes when the modal is mounted but the change is not captured by the useFocusVisible hook.

In order to capture this change, the environment is passed to useFocusVisible as the relativeDocument. A useEffect within useFocusVisible re-runs the effect accordingly when the relativeDocument is updated.

🙏 Thanks @Austin94 for helping figure out the root problem.

Screenshots

Before:

2020-09-22 08 59 13

After:

2020-09-22 08 58 49

Checklist

  • 🌐 Styleguidist demo is up-to-date (yarn start)
  • ⬅️ renders as expected with reversed (RTL) direction
  • 🤘 renders as expected with Bedrock CSS (?bedrock)
  • ♿ analyzed via axe and evaluated using VoiceOver
  • 💂‍♂️ includes new unit tests
  • 📝 tested in Chrome, Firefox, Safari, Edge, and IE11

@hzhu hzhu self-assigned this Sep 22, 2020
@hzhu hzhu force-pushed the hzhu/modal-focusvisible branch 2 times, most recently from c6d3792 to 94e900a Compare September 22, 2020 16:56
@coveralls
Copy link

coveralls commented Sep 22, 2020

Coverage Status

Coverage increased (+0.0009%) to 95.834% when pulling c7ffc2c on hzhu/modal-focusvisible into 08616ae on main.

@zendesk-garden zendesk-garden requested a deployment to staging September 22, 2020 17:35 Abandoned
packages/modals/src/elements/Modal.tsx Outdated Show resolved Hide resolved
@hzhu hzhu marked this pull request as ready for review September 22, 2020 17:58
@hzhu hzhu requested a review from a team as a code owner September 22, 2020 17:58
@zendesk-garden zendesk-garden temporarily deployed to staging September 22, 2020 18:28 Inactive
@hzhu hzhu merged commit d5ddd6f into main Sep 22, 2020
@hzhu hzhu deleted the hzhu/modal-focusvisible branch September 22, 2020 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

4 participants