Closed JoHeyJo closed 1 year ago
Hey! Thank you for your bug report! Much appreciated! 🙏
This is expected behaviour because the checkboxes aren't hooked up to anything. We didn't want to do that because we didn't want it to be too opinionated. For example we can:
Right now what is happening is that the panel is unmounting / remounting and therefore throwing away DOM related state.
What you can do depends on what you actually want:
Popover.Panel
to not unmount by using <Popover.Panel unmount={false}>...</Popover.Panel>
that way everything stays in the DOM and when you re-open it the state will still be there. You have to watch out with this because if you have a lot of items in the DOM your page can get slower because there is unnecessary stuff to keep track off. (Please measure this if you run into performance issues!)Popover.Panel
because it will read the data from those state hooks.I hope this helps!
Robin,
thank you, that is very helpful and informative about the inner workings Panel.Popover. I wasn't aware of a unmount property which is nice to know about. Thanks for pointing all of those options out. I did some digging bc I thought the checkbox was tied to the state so I started thinking that maybe it worked independently of it or something else I wasn't aware of. Anyway, I found that it wasn't tied to the component state but rather to how the data was being passed to the component itself, which did reflect the info in the dev tools. I don't think I would have thought to go back and double-check that anytime soon since I thought it was all already tied together. 😅 Thanks again!
On Fri, Nov 4, 2022 at 12:16 PM Robin Malfait @.***> wrote:
Closed #1359 https://github.com/tailwindlabs/tailwindui-issues/issues/1359 as completed.
— Reply to this email directly, view it on GitHub https://github.com/tailwindlabs/tailwindui-issues/issues/1359#event-7743350752, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVKIQIR2GLHD2QCXQPCVO73WGVOKRANCNFSM6AAAAAARXO7EAY . You are receiving this because you authored the thread.Message ID: @.*** com>
-- Joannes Figueroa
What component (if applicable)
Describe the bug If I check one of the checkboxes in the dropdown panel, close it, and open it again, the checkbox is "unchecked". The checkbox seems to get reset every time the panel is closed. Instead of the normal behavior which would be for the checkbox to remain "checked".
To Reproduce
Expected behavior When the user opens the dropdown panel and "checks" any checkbox and closes the dropdown panel. The checkbox should remain "checked" until user "unchecks" it.
Screenshots If applicable, add screenshots to help explain your problem.
Browser/Device (if applicable)
Additional context Input tag and label tag are pointing to each other. Also, I've tried the code exactly as it comes from Tailwind, without any modifications and the issue persists. However, it seems to be working just fine on the website. Link above.