Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Filament Unsaved Changes Modal

Filament Unsaved Changes Modal Laravel Package

azgasim/filament-unsaved-changes-modal

Replaces Filament's browser confirmation dialog with a native Filament modal when leaving a dirty form. Works with SPA and full-page navigation, using the same dirty-state rules as unsavedChangesAlerts(). Requires Filament 5.3.5+ and PHP 8.2+.

View on GitHub
Deep Wiki
Context7

Filament Unsaved Changes Modal replaces the browser's blocking confirmation dialog with a native Filament modal when you try to leave a dirty form in your panel. It plugs directly into Filament's existing unsavedChangesAlerts() behavior, so dirty-state rules stay identical—only the confirmation UI changes. Reloading or closing the tab still falls back to the browser prompt.

  • Works with Filament SPA (livewire:navigate) and normal full-page navigation
  • Same dirty-state rules as Filament's unsavedChangesAlerts()
  • Zero configuration beyond ->plugin(FilamentUnsavedChangesModalPlugin::make())
  • Requires Filament 5.3.5+ (patches a known XSS vulnerability) and PHP 8.2+
Frequently asked questions about Filament Unsaved Changes Modal
How do I install azgasim/filament-unsaved-changes-modal?
Install it with Composer by running composer require azgasim/filament-unsaved-changes-modal in your Laravel project. Then enable unsavedChangesAlerts() on your Filament panel and register FilamentUnsavedChangesModalPlugin in the same panel configuration. No additional JavaScript, middleware, or database setup is required.
Which Filament and PHP versions does this plugin support?
Version 1.x of the plugin targets Filament ^5.3.5 and PHP ^8.2. The Filament 5.3.5 minimum exists because earlier releases contain a known XSS vulnerability (CVE-2026-33080). Confirm your project meets these constraints before installing.
Do I still need unsavedChangesAlerts() enabled on my Filament panel?
Yes. The plugin does not implement its own dirty-state tracking; it hooks into Filament's existing unsaved-changes event and replaces only the confirmation UI. You need both unsavedChangesAlerts() and the plugin registered on the same panel for the modal to appear.
How do I register the plugin in my Filament panel provider?
Add FilamentUnsavedChangesModalPlugin::make() to your panel, either via ->plugin(FilamentUnsavedChangesModalPlugin::make()) or inside the ->plugins([...]) array in your AdminPanelProvider. Keep the ->unsavedChangesAlerts() call in the same chain. Restart or refresh the panel and the modal will replace the native prompt for in-panel navigation.
Does the plugin work with Filament SPA navigation using livewire:navigate?
Yes, it supports Filament's SPA mode where navigation happens through livewire:navigate. The confirmation modal is shown before the Livewire navigation proceeds. With multiple dirty forms or very rapid navigation, it is worth testing in staging to confirm the expected behavior.
Does it also replace the browser dialog for normal full-page navigation?
Yes, for same-origin link clicks inside the panel body the plugin intercepts navigation and shows the Filament modal instead. The native browser prompt is not used in that flow. This makes it useful for hybrid apps that mix SPA and traditional page loads.
Why do I still see a native browser prompt when reloading or closing the tab?
Browsers only allow a generic, non-customizable confirmation for reloads and tab closures, so that behavior cannot be replaced with a Filament modal. The plugin covers in-panel navigation only. Set expectations with stakeholders that reload and close prompts remain native.
Does the plugin require custom JavaScript, migrations, or database changes?
No. It is a UI-focused Filament plugin that relies on Filament's existing event system and Alpine.js modal components. There are no schema changes, queries, or custom scripts to maintain. Integration is limited to Composer, the panel provider, and the existing unsavedChangesAlerts() call.
Can I customize the modal title, text, and buttons?
The modal is rendered with Filament's own modal component, so it inherits your panel's design system and theme. The README excerpt does not document dedicated config keys or translation publishing, so check the repository source before relying on custom copy. Heavy theming may require overriding Filament's modal views.
How should I test unsaved changes behavior after installing?
In staging, try SPA navigation via livewire:navigate, full-page same-origin link clicks, and scenarios with multiple dirty forms or rapid navigation. Also confirm that reload and tab-close still trigger the native browser prompt. If your app has no existing tests for unsaved changes, add manual checks or browser tests for these flows.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib