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 broken escape key behaviour #754

Merged
merged 2 commits into from
Aug 24, 2021
Merged

Fix broken escape key behaviour #754

merged 2 commits into from
Aug 24, 2021

Conversation

RobinMalfait
Copy link
Member

We've "fixed" an issue when we had nested Dialogs (#430).
The escape would not close the correct Dialog. The issue here was with
the logic to know whether we were the last Dialog or not. The issue was
not how we implemented the close functionality.

To make things easier, we moved the global window event to a scoped div
(the Dialog itself). While that fixed the nested Dialog issue, it
introduced this bug where escape would not close if you click on a
non-focusable element like a span in the Dialog.

Since that PR we did a bunch of improvements on how the underlying
"stacking" system worked.
This PR reverts to the "global" window event listener so that we can
still catch all of the escape keydown events.

Fixes: #524
Fixes: #693

We've "fixed" an issue when we had nested Dialogs ([#430](#430)).
The `escape` would not close the correct Dialog. The issue here was with
the logic to know whether we were the last Dialog or not. The issue was
_not_ how we implemented the `close` functionality.

To make things easier, we moved the global window event to a scoped div
(the Dialog itself). While that fixed the nested Dialog issue, it
introduced this bug where `escape` would not close if you click on a
non-focusable element like a span in the Dialog.

Since that PR we did a bunch of improvements on how the underlying
"stacking" system worked.
This PR reverts to the "global" window event listener so that we can
still catch all of the `escape` keydown events.

Fixes: #524
Fixes: #693
@vercel
Copy link

vercel bot commented Aug 24, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

headlessui-vue – ./packages/@headlessui-vue

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-vue/Gaq9w2Yz9jX2UBMQCsVyTtGuw8k4
✅ Preview: https://headlessui-vue-git-fix-escape-on-dialog-tailwindlabs.vercel.app

headlessui-react – ./packages/@headlessui-react

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-react/F2qTd9Uway45brz7FS9rXaRey9vq
✅ Preview: https://headlessui-react-git-fix-escape-on-dialog-tailwindlabs.vercel.app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant