Flowbite Drawer incorrectly applies left: 0 and translateX(-100%) in Rails 7 (Turbo) environment
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, rails, tailwindcss
- Ambito
- frontend
Direzione di ricerca
Riproduci il problema nella configurazione Rails 7/Turbo usando il markup del drawer e bin/dev, quindi ispeziona l’inizializzazione di initDrawers() di Flowbite in corrispondenza di turbo:load. Traccia il motivo per cui a right-0 e translate-x-full seguono left-0 e translateX(-100%). Il lavoro è completato quando il drawer rimane nascosto fuori dallo schermo a destra e si apre da destra quando viene attivato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Title: Flowbite Drawer incorrectly slides from left in Rails 7 (Turbo) app, adds conflicting styles left: 0 and translateX(-100%)
Describe the bug
When using the Flowbite Drawer component in a Ruby on Rails 7 application (which uses Turbo by default), the drawer component incorrectly slides in from the left, even when the HTML is explicitly configured for a right-side drawer as per the documentation.
This happens in the mobile view when using the standard data-drawer-toggle button.
Inspecting the element in the developer tools reveals the bug: Flowbite's JavaScript is programmatically adding left: 0 to the drawer's class list and an inline style="transform: translateX(-100%);". These injected styles directly conflict with the right-0 and translate-x-full classes in the source HTML, causing the drawer to appear from the left.
To Reproduce
Steps to reproduce the behavior:
- Set up a standard Rails 7 application with
turbo-railsandflowbite(e.g., via theflowbite-railsgem or NPM/Vite). - In the main layout, render a header partial.
- In the header partial, add the HTML for a mobile-only toggle button and a drawer, using the "HTML-first" classes for right-side placement (as per the Flowbite docs).
<button id="mobile-menu-btn" ... type="button" data-drawer-target="mobile-menu-drawer" data-drawer-toggle="mobile-menu-drawer"> </button> <div id="mobile-menu-drawer" class="fixed top-0 right-0 z-50 h-screen p-4 overflow-y-auto transition-transform translate-x-full bg-blue-900 w-80"> <button type="button" data-drawer-hide="mobile-menu-drawer" aria-controls="mobile-menu-drawer"> </button> </div> - Start the Rails server (
bin/dev). - Load the page and shrink the browser viewport to the mobile breakpoint to show the toggle button.
- Click on the toggle button.
- See error: The drawer (
#mobile-menu-drawer) slides in from the left. - See error (in Dev Tools): Inspecting the drawer
divshows the conflicting styles have been added by Flowbite's JS:class="... right-0 ... translate-x-full ... left-0"andstyle="transform: translateX(-100%);".
Expected behavior
The drawer, which is correctly configured in the HTML with right-0 and translate-x-full, should be hidden off-screen to the right. When the toggle button is clicked, it should slide into view from the right.
Screenshots
(If applicable, add screenshots to help explain your problem. You can drag and drop your images directly into the GitHub issue.)
Desktop (please complete the following information):
- OS: macOS
- Browser: Chrome
- Version: Latest
Smartphone (please complete the following information):
- Device: iPhone 14 Pro, iPad Pro (simulators and real devices)
- OS: iOS 16+
- Browser: Safari, Chrome
- Version: Latest
Additional context
This is a JavaScript initialization race condition caused by Rails Turbo. Flowbite's initDrawers() script is applying its default (left-side) styles before it has correctly parsed the element's right-0 / translate-x-full classes, likely due to the turbo:load event.
We have followed the official documentation for an HTML-first, right-side drawer setup. Standard workarounds, such as adding a turbo:load event listener in application.js to manually re-run initDrawers(), did not solve the issue. This suggests a deeper conflict between Flowbite's initialization logic and the Turbo-Rails environment.
- Lingua principale
- HTML
- Stelle
- 9.4k
- Fork
- 867
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di themesberg/flowbite
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
themesberg/flowbite#1154 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
themesberg/flowbite#1153 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
themesberg/flowbite#1127 · 2 commenti ·
-
Convert px units to rem for typography variables.Forse già presa @ninjadevpunk l’ha presa 210 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
themesberg/flowbite#1120 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
themesberg/flowbite#1016 · 1 commento ·
Tutte le issue di themesberg/flowbite
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 91/100
marimo-team/marimo#11768 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue priority: high size: XS
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
[Studio feedback] 对话内容向下滚动时执行过程吸顶时,由于背景色是透明的,导致执行过程标题与下面的具体执行内容重叠,导致了两行信息重叠显示;建议执行过程的背景色设置为会话界面的背景Apertabug from-studio
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
esengine/DeepSeek-Reasonix#15044 ·
I maintainer di solito rispondono entro 1 giorno
-
Web wizard: "Launch without Sandbox" can switch a Structured create to Terminal in the same clickApertaarea:web bug needs-triage P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agent-of-empires/agent-of-empires#5489 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: 对话界面点击右上角设备管理后,无法返回Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
EKKOLearnAI/ekko-studio#3729 ·
I maintainer di solito rispondono entro 1 giorno