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

Expose close functionality #697

Merged
merged 4 commits into from
Jul 26, 2021
Merged

Conversation

RobinMalfait
Copy link
Collaborator

@RobinMalfait RobinMalfait commented Jul 26, 2021

In addition to the Popover.Button inside a Popover.Panel and a Disclosure.Button inside a Disclosure.Panel, we will now expose a close function in the render prop. This will give you a bit more control over how you can close the Disclosure and Popover.

The close function is exposed on the following components:

  • Popover
  • Popover.Panel & PopoverPanel
  • Disclosure
  • Disclosure.Panel & DisclosurePanel

When you call the close function with no arguments, then we will restore the focus to the Popover.Button or Disclosure.Button for accessibility purposes.

You can also passthrough an actual element, or a ref to focus that element instead.

@vercel
Copy link

vercel bot commented Jul 26, 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-react – ./packages/@headlessui-react

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-react/NYXKmURxkNvVZ3Nr4hp53LJBXQDP
✅ Preview: https://headlessui-react-git-expose-close-functionality-tailwindlabs.vercel.app

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

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-vue/ERpSUEPa4hGkt1591hdob8N9cApz
✅ Preview: https://headlessui-vue-git-expose-close-functionality-tailwindlabs.vercel.app

@RobinMalfait RobinMalfait changed the title expose close functionality Expose close functionality Jul 26, 2021
@RobinMalfait RobinMalfait merged commit ba1bd52 into develop Jul 26, 2021
@RobinMalfait RobinMalfait deleted the expose-close-functionality branch July 26, 2021 14:07
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.

None yet

1 participant