themesberg / flowbite

Open-source UI component library and front-end development framework based on Tailwind CSS
https://flowbite.com
MIT License
7.31k stars 710 forks source link

When using the sidebar (drawer) it does not open/close on mobile if using Turbo #793

Open Doddlin opened 5 months ago

Doddlin commented 5 months ago

Describe the bug Using Ruby on Rails with turbo_frames breaks navbar functionality in terms of the animation on mobile. Functionality to add/remove backdrop fails and cancels any more runs in JS. Need to reload the page for the functionality to come back up.

To Reproduce Steps to reproduce the behavior: Use the free Application https://flowbite.com/blocks/application/shells/#application-shell-with-sidebar-and-navbar and let the main area be a turbo-frame. Navigate to a page on mobile Try to open the drawer again Error will be: "TypeError: Cannot read properties of null (reading 'remove')"

Expected behavior I would expect the drawer to open

Desktop (please complete the following information):

Additional context I am getting an error from index.ts:221 Possibly there are two backdrop elements created

daniel-rikowski commented 5 months ago

I can't reproduce that problem, but I guess this most likely is a known bug, which should already be fixed (See https://github.com/themesberg/flowbite/pull/751, https://github.com/themesberg/flowbite/pull/665, https://github.com/themesberg/flowbite/commit/292da5a6e75bfa2702e1f4ee8cdcb1e7ef58a05c)

Do you use version 2.2.1 or at least 2.0.0?

Doddlin commented 5 months ago

Yeps, that makes sense, looks like it covers the same error. I am on 2.2.1.