Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

2.0.2 · 2026-10-23

Fixed

  • Body scroll now stays locked until every ModalProvider sharing the document closes its modals, instead of unlocking when the first provider closes. The original inline overflow value is restored when the last lock releases, in any closing or unmounting order.
  • A single Escape now cancels only the top modal of the most recently opened provider. Other providers keep their stacks, and a top modal with closeOnPressEsc: false blocks Escape for every provider instead of leaking the keypress to modals underneath.
  • Covered and exiting modal layers are now inert, so their content can no longer receive focus or clicks while an exit animation finishes.
  • Closing a stacked modal restores focus to the exact element that was focused before it opened (the trigger for the last modal), instead of always jumping to the first focusable element.
  • Providers portaled into a separate document (for example an iframe root) now lock scroll and handle keyboard input within that document.

Changed

  • The provider that opened the most recent modal owns keyboard interaction, including when several providers have modals open at the same time. See the "Multiple providers on one document" section of the provider docs.

Added

  • The owning provider now renders above every other provider: the newest claim raises its portal container, so visual, Escape and Tab order always match across providers.
  • Focus that escapes the stack programmatically (application code focusing a background element while a modal is open) is pulled back into the top dialog.
  • Scroll locking now also pins overscroll-behavior: none on the body, cancels background touch drags (mobile Safari), and sets overscroll-behavior: contain on dialog bodies so inner scrolling does not chain to the page.

2.0.1 · 2026-08-14

Fixed

  • Browser Back and Forward navigation now cancels the full modal stack instead of leaving dialogs open across history entries.
  • Added browser regression coverage and an example flow for verifying history navigation behavior.

2.0.0 · 2026-07-30

First stable release of the awaitable, typed modal system.

Breaking

  • Replaced the global modalStore and module augmentation API with isolated systems created by createModalSystem().
  • Replaced injected flat modal props with ModalRenderProps<Input, Result>.
  • Changed ModalProvider registration from modals to system.

Added

  • Added typed, awaitable open() outcomes with explicit cancellation reasons.
  • Added stack, replace, and singleton orchestration policies.
  • Added headless dialog, drawer, and sheet motion presets.
  • Added automatic reduced-motion rendering and provider-unmount cancellation.
  • Added a v1-to-v2 migration guide and typed-flow examples.

Changed

  • Made the distributed stylesheet structural and headless; applications now own backdrop color, surface styling, spacing, and shadows.
  • Separated business input from per-open rendering and interaction options.

1.4.0 · 2026-07-30

Fixed

  • Bound injected close handlers to modal instance IDs, so repeated modal names close the correct instance.
  • Made closing an empty or missing modal a safe no-op and prevented rapid repeated close actions from throwing.
  • Made closeAllModal() invoke each open modal's onClose callback once.
  • Fixed modals opened before ModalProvider mounts so the portal renders after the body root is available.
  • Added a real Tab focus trap, accessible dialog naming props, and inactive-dialog isolation for stacked modals.
  • Allowed oversized modal bodies to scroll instead of clipping their content.
  • Prevented edge and corner positions from squeezing modal bodies into half or quarter viewports on smaller screens.
  • Prevented horizontal scrollbars from flashing while positioned modals animate into view.

Added

  • Exported the full public type surface, including Params, BaseModalParams, ModalConfig, and ModalInitialParams.
  • Added Chromium browser regression tests for portal rendering, focus containment, accessible names, and responsive modal placement.

Changed

  • Docs deployment now triggers on documentation changes to main (and manual dispatch) instead of tag pushes, because the GitHub Pages environment does not allow tag-based deployments.
  • Release publishing now runs lint, type checks, unit tests, browser tests, build, and package verification before publishing.
  • Trusted publishing now uses Node 24 and a compatible npm 11 release instead of upgrading to an incompatible npm major.

1.3.2 · 2026-06-27

Fixed

  • Fixed onClose firing twice when a modal is closed by clicking outside it; the store is now the single source of truth for the callback.
  • Fixed closeModal(name) leaving active pointing at the wrong modal when a non-topmost modal is closed by name.
  • Enforced the documented closeOnPressEsc default of true; pressing Escape now closes the topmost modal unless explicitly disabled.
  • Synced the blur JSDoc default with its runtime default (true).
  • Fixed API documentation headings so inline code titles keep the gradient text treatment without showing an inline-code background.

Added

  • Accessibility baseline: dialogs now render with role="dialog" and aria-modal="true", lock background scroll while open, move focus into the active dialog on open, and restore focus to the trigger when the stack empties.
  • Unit tests for the modal store.
  • A Husky pre-commit hook that runs Biome format + lint on staged files.
  • An apps/example Vite app that imports the library source for local testing.

Changed

  • Externalized motion and zustand from the published bundle so peer dependencies are no longer duplicated, reducing package size.
  • Declared sideEffects for the stylesheet and removed the vestigial path dependency and an invalid require export map entry.
  • The docs site now rebuilds only on tag pushes or when documentation files change.

1.3.1 · 2026-06-05

Changed

  • Switched the library version bump scripts to Yarn and removed the root package-lock.json from the repository and future commits.
  • Updated the published package homepage to point to the GitHub Pages documentation site.
  • Restored the Turbo task pipeline and added a dedicated check-types script for the library workspace so CI can run type checks again.
  • Restored the default click-outside behavior so clicking the backdrop closes a modal unless it is explicitly disabled.
  • Added a root LICENSE file so repository and package tooling can detect the MIT license from the monorepo root.

1.3.0 · 2026-06-01

Changed

  • Converted the repository to a Turbo monorepo with apps/library, apps/document, and shared TypeScript config packages.
  • Moved the published library source, package metadata, README, license, and security files into apps/library.
  • Replaced the root Prettier setup with a root-level Biome setup and wired lint / format scripts through the workspaces.
  • Added a Docusaurus documentation site in apps/document, including API, guide, getting started, and changelog pages.
  • Added GitHub Pages deployment for the docs site and updated CI workflows to build from the monorepo layout.
  • Renamed store and provider entrypoints to src/stores/modal.ts and src/providers/modal.tsx, and updated public exports accordingly.
  • Renamed type files to shorter names such as base-modal-params.ts, modal-components.ts, and modal-state.ts.
  • Removed the bundled example app source from src/example and the unused example stylesheet from the package source.
  • Extracted modal class-name and body animation helpers into src/utils, and moved modal animation constants and z-index constants into src/configs/constant.ts.
  • Replaced uuid, keyboardjs, and clsx usage with built-in JavaScript and DOM APIs, removing those packages from runtime dependencies.
  • Updated the README install note and examples to reflect the current modalStore API and peer dependency expectations.

1.2.8 · 2026-06-01

Added

  • Added GitHub Actions workflows for CI and npm publishing with provenance.
  • Added a SECURITY.md policy and an MIT LICENSE file to document release and security expectations.
  • Added release:check and ci scripts to validate release artifacts and CI builds consistently.
  • Added npm, bundle, type, issue, and Socket badges to the README.

Changed

  • Documented the trusted publishing release flow in the README.
  • Replaced the manual local publish script with a CI-oriented release verification script.

1.2.6 · 2026-05-31

Changed

  • Removed Tailwind CSS and the Tailwind Vite plugin from package dependencies.
  • Replaced the example app Tailwind utilities with plain CSS classes.
  • Moved modal default layout to main.css with zero-specificity selectors so consumer classes can override defaults without !important.
  • Added modal positions: top, top-left, top-right, top-center, left, right, bottom, bottom-left, bottom-right, bottom-center, center, and center-full.
  • Added default position-aware body animations for edge and corner placements.

1.2.5 · 2026-05-30

Fixed

  • Removed Tailwind CSS injection from the distributed library build.
  • Moved Tailwind CSS import to the example app only.
  • Replaced internal modal layout Tailwind classes with inline styles to avoid overriding consumer app utilities.

1.2.4 · 2025-05-30

Changed

  • Split modal.type.ts into separate files for better maintainability.
  • base-modal-params.type.ts handled base modal parameter types.
  • modal-components.type.ts handled modal component and config types.
  • modal-state.type.ts handled modal state and action types.
  • modal.type.ts re-exported all types for backward compatibility.
  • Bumped dependencies such as motion, zustand, vite, tailwindcss, biome, and playwright.

1.2.3 · 2025-05-30

Fixed

  • Fixed ModalParams so it correctly extends ModalDefinition[T] with closeModal.
  • Updated dependencies for stability.

1.2.2 · 2025-11-21

Added

  • Enhanced TypeScript documentation with comprehensive JSDoc comments.
  • Added more detailed examples for modal animations and positioning.
  • Improved documentation for the blur effect parameter.
  • Added more complete examples for ModalComponent and ModalConfig.

Changed

  • Improved type documentation with more realistic usage examples.
  • Expanded Framer Motion animation configuration documentation.
  • Clarified modal positioning options.

Fixed

  • Type definitions now import required dependencies correctly.
  • Documentation examples now match the current API.