Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8953 +/- ##
=======================================
Coverage 99.08% 99.08%
=======================================
Files 139 140 +1
Lines 4046 4059 +13
=======================================
+ Hits 4009 4022 +13
Misses 37 37 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e18afaa to
e09b0c4
Compare
e09b0c4 to
707648f
Compare
707648f to
f1b9a55
Compare
f1b9a55 to
fcf631e
Compare
There was a problem hiding this comment.
Pull request overview
This PR removes the Flowbite dependency (~80KB) from Active Admin and replaces its three JS components (dropdown, drawer, modal) with focused, minimal modules using @floating-ui/dom (~22KB vendored ESM) for dropdown positioning and pure JS/CSS for drawer and modal. Data attributes are preserved for backward compatibility.
Changes:
- Replace Flowbite with three new JS feature modules (
dropdown.js,drawer.js,modal.js) and vendor@floating-ui/dom+@floating-ui/coreESM bundles - Remove all Flowbite-related dependencies from
package.json,yarn.lock,config/importmap.rb,vendor/javascript/, and Tailwind content scanning - Add Cucumber feature tests and a planning document, and update documentation references
Reviewed changes
Copilot reviewed 14 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app/javascript/active_admin/features/dropdown.js | New dropdown module using Floating UI for positioning |
| app/javascript/active_admin/features/drawer.js | New pure-JS drawer module with CSS transitions |
| app/javascript/active_admin/features/modal.js | New pure-JS modal module with backdrop and Escape handling |
| app/javascript/active_admin.js | Replace flowbite import with new feature module imports |
| vendor/javascript/@floating-ui--core.js | Vendored ESM bundle for @floating-ui/core |
| vendor/javascript/@floating-ui--dom.js | Vendored ESM bundle for @floating-ui/dom |
| vendor/javascript/floating-ui--dom.js | Vendored UMD bundle (appears unused by importmap) |
| vendor/javascript/flowbite.js | Deleted Flowbite vendor file |
| config/importmap.rb | Replace flowbite pin with @floating-ui/core and @floating-ui/dom pins |
| package.json | Replace flowbite dependency with @floating-ui/dom |
| yarn.lock | Updated lockfile reflecting dependency changes |
| tasks/dependencies.rake | Updated vendor task to copy floating-ui instead of flowbite |
| lib/generators/active_admin/assets/templates/tailwind.config.js | Remove flowbite.js from Tailwind content scanning |
| features/javascript_components.feature | New Cucumber feature with 7 scenarios for JS components |
| features/step_definitions/component_steps.rb | New step definitions for component interaction |
| docs/plan-remove-flowbite.md | Planning document for the Flowbite removal |
| UPGRADING.md | Update batch action modal references |
| README.md | Replace Flowbite credit with Floating UI |
| .github/copilot-instructions.md | Update technology stack documentation |
| ## Summary of data attribute changes | ||
|
|
||
| | Current (Flowbite) | New (ActiveAdmin) | Component | | ||
| |---|---|---| | ||
| | `data-dropdown-toggle` | `data-aa-dropdown-toggle` | Dropdown | | ||
| | `data-dropdown-placement` | `data-aa-dropdown-placement` | Dropdown | | ||
| | `data-dropdown-offset-distance` | `data-aa-dropdown-offset` | Dropdown | | ||
| | `data-drawer-target` | `data-aa-drawer-target` | Drawer | | ||
| | `data-drawer-show` | `data-aa-drawer-show` | Drawer | | ||
| | `data-modal-target` | `data-aa-modal-target` | Modal | | ||
| | `data-modal-show` | `data-aa-modal-show` | Modal | | ||
| | `data-modal-hide` | `data-aa-modal-hide` | Modal | | ||
|
|
||
| > **Note**: Namespacing with `aa-` prevents conflicts with other libraries users may have. Alternatively, keep short names without prefix — decision needed. |
There was a problem hiding this comment.
The plan document states that data attributes will be renamed with an aa- prefix (e.g., data-aa-dropdown-toggle, data-aa-modal-show), but the actual implementation keeps the original Flowbite attribute names (data-dropdown-toggle, data-modal-show, etc.) for backward compatibility. The "Summary of data attribute changes" table is now inaccurate and will confuse anyone reading this planning doc. Either update the table to reflect the decision to keep original names, or add a note that the aa- prefix was not adopted in favor of backward compatibility.
e31e55a to
345a2b1
Compare
1ba25c0 to
c5fa716
Compare
96f1c7b to
cf46523
Compare
| } | ||
|
|
||
| const escapeKey = function(event) { | ||
| if (event.key === "Escape") { close() } |
There was a problem hiding this comment.
The escapeKey handler in drawer.js, modal.js, and dropdown.js all listen on document for keydown with event.key === "Escape". When a modal is open, pressing Escape will fire all three handlers — the modal closes, the drawer closes (if any), and the dropdown closes (if any). While these components are unlikely to be open simultaneously in normal usage, the lack of event.stopPropagation() or any coordination means a single Escape press leaks through all modules. This could matter if a modal were opened from within a dropdown action without first closing the dropdown. Consider having the modal and drawer escapeKey handlers call event.stopPropagation() (or at least check that their respective component is active before stopping propagation) to prevent unintended cascade.
| if (event.key === "Escape") { close() } | |
| if (!activeModal) { return } | |
| if (event.key === "Escape") { | |
| event.stopPropagation() | |
| close() | |
| } |
cf46523 to
d73214e
Compare
Remove the Flowbite dependency (~80KB) and replace its three JS components (dropdown, drawer, modal) with focused, minimal modules that follow the existing Rails.delegate event delegation pattern. Dropdown positioning uses @floating-ui/dom (~22KB vendored ESM). Drawer and modal are pure JS with CSS transitions, no external dependencies. Data attributes are preserved (data-dropdown-toggle, data-drawer-show, data-modal-show, data-modal-hide) for backward compatibility with existing user templates and batch action partials. Modal backdrop click is detected via `event.target === activeModal` since the backdrop div sits behind the modal container in z-order. - Add app/javascript/active_admin/features/dropdown.js - Add app/javascript/active_admin/features/drawer.js - Add app/javascript/active_admin/features/modal.js - Vendor @floating-ui/dom@1.7.5 as self-contained ESM bundle - Remove flowbite from package.json, importmap, vendor, content scan - Update dependencies.rake to bundle `@floating-ui/dom` - Add features/javascript_components.feature with 7 @javascript scenarios covering dropdown, modal open/close, Escape key, and backdrop click - Add features/step_definitions/component_steps.rb with supporting steps
d73214e to
6442b08
Compare
| drawer.setAttribute("aria-modal", "true") | ||
| drawer.setAttribute("role", "dialog") | ||
|
|
||
| document.body.classList.add("overflow-hidden", "xl:overflow-auto") |
There was a problem hiding this comment.
Copilot:
Short answer: xl:overflow-auto applies overflow-auto only at the xl breakpoint and up, whereas applying overflow on the body would affect every viewport size. It's a responsive change to avoid global side-effects on smaller screens.
Why this is done (concise):
- Breakpoint scope:
xl:overflow-auto→ only on extra‑large screens;body { overflow: auto }→ always. - Prevents unwanted scroll behavior on mobile: a global
bodyoverflow can create double scrollbars or allow background scrolling when modals/drawers are shown. - Keeps smaller-screen UX native (touch/scroll) while enabling an internal scroller for large desktop layouts (e.g., fixed sidebars, content columns).
- Helps contain scrollable regions (drawers, dropdowns, modals) to a specific layout at large widths without breaking responsive stacking at smaller widths.
I think this does not apply here, because we have a backdrop.
There is actually a difference in behavior, but it only happens if you are at small window size, you open the drawer, you resize the window to xl screen, you try to scroll
e11df66 to
654570a
Compare
Remove the Flowbite dependency (~80KB) and replace its three JS
components (dropdown, drawer, modal) with focused, minimal modules
that follow the existing Rails.delegate event delegation pattern.
Dropdown positioning uses
@floating-ui/dom(~22KB vendored ESM).Drawer and modal are pure JS with CSS transitions, no external
dependencies.
Data attributes are preserved (data-dropdown-toggle, data-drawer-show,
data-modal-show, data-modal-hide) for backward compatibility with
existing user templates and batch action partials.
Modal backdrop click is detected via
event.target === activeModalsince the backdrop div sits behind the modal container in z-order.
@floating-ui/dom@1.7.5as self-contained ESM bundle@floating-ui/dom@javascriptscenarioscovering dropdown, modal open/close, Escape key, and backdrop click