v2 is a full modernization: accessible dialog, current toolchain, cleaned-up API.
📦 npm: https://www.npmjs.com/package/react-tailwind-flex-modal
⚠️ Breaking changes
- The stylesheet moved from
dist/index.cssto thereact-tailwind-flex-modal/styles.cssexport and is no longer pulled in as a side effect of importing the component:import 'react-tailwind-flex-modal/styles.css'
- Tailwind 4 is required.
- The package is now ESM-first with an
exportsmap (CJS still available).
The v1 prop names still work — they are marked @deprecated and resolve to the new API — so existing consumers keep running once the CSS import is updated. See the migration table in the README.
♿ Accessibility
- Renders through a portal so no clipping or stacking parent can hide the modal.
role="dialog"+aria-modal, labelled and described by title and message.- Traps Tab/Shift+Tab, focuses the close button on open (never the destructive one), restores focus to the opener on unmount.
- Locks body scroll, restoring the previous overflow rather than clearing it.
- Dismisses on backdrop click, opt out with
closeOnBackdropClick.
🐛 Fixes
- Resolved
./Modal/Modal.jsximport Jest could not handle. - Replaced the placeholder test with a real suite (38 tests).
- Approval handlers are now optional; a simple modal no longer fails to typecheck.
- Fixed
rose-600typo (##E11D48), npm badge,fomModaltypo, and two documented defaults that disagreed with the code. - Added the MIT LICENSE file the manifest already claimed.
🔧 Toolchain
microbundle-crl→tsup(ESM + CJS + d.ts),react-scripts→ Vitest.- Tailwind 2 → 4, deleting ~170 hand-copied colour definitions.
- TypeScript 5.9 strict, ESLint 9 flat config, React 18 || 19 peer range.
- Inlined the warning icon as SVG, dropping the
react-iconsruntime dependency. - Travis → GitHub Actions; examples app migrated from CRA to Vite.
- 1920 packages → 449; 208 vulnerabilities (12 critical) → 1 low, dev-only.
Full Changelog: v1.9.3...v2.0.0