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

Bubble Escape event even if Combobox.Options is not rendered at all #1104

Merged
merged 2 commits into from
Feb 11, 2022

Conversation

RobinMalfait
Copy link
Collaborator

If you use <Combobox.Options static /> it means that you are in
control of rendering and in that case we also bubble the Escape
because you are in control of it.

However, if you do something like this:

{filteredList.length > 0 && (
  <Combobox.Options static>
    ...
  </Combobox.Options>
)}

Then whenever the filteredList is empty, the Combobox.Options are not
rendered at all which means that we can't look at the static prop. To
fix this, we also bubble the Escape event if we don't have a
Combobox.Options at all so that the above example works as expected.

If you use `<Combobox.Options static />` it means that you are in
control of rendering and in that case we also bubble the `Escape`
because you are in control of it.

However, if you do something like this:
```js
{filteredList.length > 0 && (
  <Combobox.Options static>
    ...
  </Combobox.Options>
)}
```
Then whenever the `filteredList` is empty, the Combobox.Options are not
rendered at all which means that we can't look at the `static` prop. To
fix this, we also bubble the `Escape` event if we don't have a
`Combobox.Options` at all so that the above example works as expected.
@vercel
Copy link

vercel bot commented Feb 11, 2022

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/playground-react

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-react/4VAzsPQh6mTiLdsyfecjoHtNruw5
✅ Preview: https://headlessui-react-git-bubble-escape-without-d19414-tailwindlabs.vercel.app

headlessui-vue – ./packages/playground-vue

🔍 Inspect: https://vercel.com/tailwindlabs/headlessui-vue/J6LKy6SFMDHWqrWJcVbVDR22dcv5
✅ Preview: https://headlessui-vue-git-bubble-escape-without-co-2b2497-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.

None yet

1 participant