Skip to content

Upgrade Flowbite from v3 to v4#8938

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/upgrade-flowbite-to-v4
Draft

Upgrade Flowbite from v3 to v4#8938
Copilot wants to merge 2 commits intomasterfrom
copilot/upgrade-flowbite-to-v4

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 14, 2026

Upgrades Flowbite from 3.1.2 to 4.0.1.

  • Updated package.json dependency and yarn.lock
  • Updated CDN URL reference in config/importmap.rb
  • Re-vendored vendor/javascript/flowbite.js from the v4 dist

Flowbite v4 maintains backward compatibility with the data attributes API (data-dropdown-toggle, data-drawer-*, data-modal-*) used throughout the views.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.jsdelivr.net
    • Triggering command: /usr/bin/curl curl -sI REDACTED (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
    • Triggering command: /usr/bin/curl curl -svL REDACTED (dns block)
  • flowbite.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Upgrade Flowbite from version 3 to version 4 Upgrade Flowbite from v3 to v4 Feb 14, 2026
Copilot AI requested a review from tagliala February 14, 2026 23:21
Copy link
Copy Markdown
Contributor

@tagliala tagliala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please check app/views/**/*.erb to see if we need changes in the erb templates as well

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Feb 15, 2026

@copilot please check app/views/**/*.erb to see if we need changes in the erb templates as well

I checked all ERB templates in app/views/. Only two files use Flowbite data attributes:

  • _site_header.html.erb: uses data-drawer-target, data-drawer-show, data-dropdown-toggle, data-dropdown-offset-distance, data-dropdown-placement
  • resource/_batch_actions_dropdown.html.erb: uses data-dropdown-toggle, data-dropdown-offset-distance, data-dropdown-placement

I verified these attributes exist in Flowbite v4's source with identical occurrence counts as v3 — the data attribute API is fully backward compatible. No ERB template changes are needed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has been manually verified to be identical to https://cdn.jsdelivr.net/npm/flowbite@4.0.1/dist/flowbite.min.js

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.08%. Comparing base (48eda3e) to head (1b9894a).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8938   +/-   ##
=======================================
  Coverage   99.08%   99.08%           
=======================================
  Files         139      139           
  Lines        4045     4045           
=======================================
  Hits         4008     4008           
  Misses         37       37           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@tagliala tagliala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've manually tested this PR with bin/rake local server and a clean tmp/development_apps.

I do not see regressions or differences

@tagliala tagliala marked this pull request as ready for review February 15, 2026 11:42
@tagliala tagliala force-pushed the copilot/upgrade-flowbite-to-v4 branch from 248bc4c to 096f4db Compare February 17, 2026 18:45
Copilot AI and others added 2 commits February 17, 2026 19:50
Co-authored-by: tagliala <556268+tagliala@users.noreply.github.com>
@tagliala tagliala force-pushed the copilot/upgrade-flowbite-to-v4 branch from 096f4db to 1b9894a Compare February 17, 2026 18:50
@tagliala tagliala requested a review from javierjulio February 17, 2026 18:51
Copy link
Copy Markdown
Member

@javierjulio javierjulio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a problem with on v4 where it has no modal backdrop for both the hamburger menu navigation for mobile which I think Flowbite calls the Drawer component and then a plain modal for the batch action form which is available on the user nested posts index resource. The functionality for each though is working as expected so that's good. I'm not sure if anything else besides the modal backdrop is missing.

@tagliala
Copy link
Copy Markdown
Contributor

There is a problem with on v4 where it has no modal backdrop for both the hamburger menu navigation for mobile which I think Flowbite calls the Drawer component and then a plain modal for the batch action form which is available on the user nested posts index resource.

Will take a second look here

@tagliala
Copy link
Copy Markdown
Contributor

tagliala commented Feb 21, 2026

Root Cause

In Flowbite v3 (3.1.2), the modal and drawer backdrop classes used hardcoded Tailwind CSS color utilities:

backdropClasses: 'bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40',

In Flowbite v4 (4.0.1), these were changed to use a CSS custom property (theme variable):

backdropClasses: 'bg-dark-backdrop/70 fixed inset-0 z-40',

The same change was made in the Drawer component:

backdropClasses: 'bg-dark-backdrop/70 fixed inset-0 z-30',

Why bg-dark-backdrop/70 doesn't work in ActiveAdmin

The class bg-dark-backdrop/70 relies on the CSS variable --color-dark-backdrop being defined in a Flowbite v4 theme file. For example, in the default theme:

    --color-dark-backdrop: var(--color-gray-950);

ActiveAdmin does not import any Flowbite theme CSS file. It only uses the vendored JS (vendor/javascript/flowbite.js) and the Tailwind CSS plugin (plugin.js). Without the theme CSS, --color-dark-backdrop is undefined, so bg-dark-backdrop/70 resolves to a transparent/invisible background — meaning no visible backdrop appears when modals or drawers are opened.

The Fix

ActiveAdmin needs to define the --color-dark-backdrop CSS variable so that Tailwind CSS can resolve bg-dark-backdrop/70. The minimal fix is to add it to the @theme block in the generated CSS, or directly in the Tailwind plugin.

The simplest approach would be to add the variable definition in the ActiveAdmin Tailwind plugin (plugin.js) or instruct users to add it in their active_admin.css:

@import "tailwindcss";

@config "../../../tailwind-active_admin.config.js";

@theme {
  --color-dark-backdrop: var(--color-gray-950);
}

This maps dark-backdrop to gray-950, which is the Flowbite v4 default theme value, and restores the same visual behavior as the old bg-gray-900/50 (a near-black semi-transparent overlay).

Summary

Flowbite v3 Flowbite v4
Modal backdrop bg-gray-900/50 dark:bg-gray-900/80 bg-dark-backdrop/70
Drawer backdrop bg-gray-900/50 dark:bg-gray-900/80 bg-dark-backdrop/70
Requires theme CSS? No (hardcoded colors) Yes (--color-dark-backdrop)

The PR #8938 correctly vendored the new JS, but missed that v4 now depends on CSS theme variables that weren't previously needed. The --color-dark-backdrop variable (and potentially other theme variables) must be provided by ActiveAdmin for the backdrop to render.

@tagliala
Copy link
Copy Markdown
Contributor

tagliala commented Feb 21, 2026

@tagliala
Copy link
Copy Markdown
Contributor

@javierjulio it is because of default themes

they have introduced themes, and now backdropClasses is 'bg-dark-backdrop/70 fixed inset-0 z-40', where bg-dark-backdrop is a css variable.

The default theme, also "forces"

    --font-sans: 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system', 'system-ui', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', 'Noto Sans', 'sans-serif', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    --font-body: 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system', 'system-ui', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', 'Noto Sans', 'sans-serif', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';

ad advising to

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

Which is really surprising and a no-go for me, since this would introduce by default a call to external cdns and slow down the admin area


I will revert to draft and find another solution

@tagliala tagliala marked this pull request as draft March 26, 2026 08:17
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.

3 participants