From a5c6f53b583c93b1871ac1099632d47d157a0341 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Thu, 16 Oct 2025 11:09:39 +0200 Subject: [PATCH] Fix wire:dirty indicator appearing on readonly fields without wire:model binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wire:dirty.class was being applied to all form inputs, even those without wire:model bindings (like readonly fields). This caused the dirty state indicator to appear on readonly fields when other fields in the form were modified. Fixed by only applying wire:dirty.class when wire:model binding is present: - input.blade.php: Moved wire:dirty.class inside @if($modelBinding !== 'null') - textarea.blade.php: Applied same fix for all textarea variations - select.blade.php: Applied same fix for select elements This ensures only fields with actual Livewire bindings show dirty state indicators. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- resources/views/components/forms/input.blade.php | 8 ++++---- resources/views/components/forms/select.blade.php | 4 ++-- .../views/components/forms/textarea.blade.php | 14 ++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/resources/views/components/forms/input.blade.php b/resources/views/components/forms/input.blade.php index ecddc364b..6b88c7b44 100644 --- a/resources/views/components/forms/input.blade.php +++ b/resources/views/components/forms/input.blade.php @@ -27,8 +27,8 @@ class="flex absolute inset-y-0 right-0 items-center pr-2 cursor-pointer dark:hov @endif merge(['class' => $defaultClass]) }} @required($required) - @if ($modelBinding !== 'null') wire:model={{ $modelBinding }} @endif - wire:dirty.class="dark:border-l-warning border-l-coollabs border-l-4" wire:loading.attr="disabled" + @if ($modelBinding !== 'null') wire:model={{ $modelBinding }} wire:dirty.class="dark:border-l-warning border-l-coollabs border-l-4" @endif + wire:loading.attr="disabled" type="{{ $type }}" @readonly($readonly) @disabled($disabled) id="{{ $htmlId }}" name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}" aria-placeholder="{{ $attributes->get('placeholder') }}" @@ -38,8 +38,8 @@ class="flex absolute inset-y-0 right-0 items-center pr-2 cursor-pointer dark:hov @else merge(['class' => $defaultClass]) }} @required($required) @readonly($readonly) - @if ($modelBinding !== 'null') wire:model={{ $modelBinding }} @endif - wire:dirty.class="dark:border-l-warning border-l-coollabs border-l-4" wire:loading.attr="disabled" + @if ($modelBinding !== 'null') wire:model={{ $modelBinding }} wire:dirty.class="dark:border-l-warning border-l-coollabs border-l-4" @endif + wire:loading.attr="disabled" type="{{ $type }}" @disabled($disabled) min="{{ $attributes->get('min') }}" max="{{ $attributes->get('max') }}" minlength="{{ $attributes->get('minlength') }}" maxlength="{{ $attributes->get('maxlength') }}" diff --git a/resources/views/components/forms/select.blade.php b/resources/views/components/forms/select.blade.php index 1f75ff9e0..aac924f0d 100644 --- a/resources/views/components/forms/select.blade.php +++ b/resources/views/components/forms/select.blade.php @@ -11,8 +11,8 @@ class="flex gap-1 items-center mb-1 text-sm font-medium {{ $disabled ? 'text-neu @endif @error($modelBinding) diff --git a/resources/views/components/forms/textarea.blade.php b/resources/views/components/forms/textarea.blade.php index 9c4860da8..cee5faeda 100644 --- a/resources/views/components/forms/textarea.blade.php +++ b/resources/views/components/forms/textarea.blade.php @@ -45,17 +45,16 @@ class="absolute inset-y-0 right-0 flex items-center h-6 pt-2 pr-2 cursor-pointer @endif merge(['class' => $defaultClassInput]) }} @required($required) - @if ($modelBinding !== 'null') wire:model={{ $modelBinding }} @endif - wire:dirty.class="dark:border-l-warning border-l-coollabs border-l-4" wire:loading.attr="disabled" + @if ($modelBinding !== 'null') wire:model={{ $modelBinding }} wire:dirty.class="dark:border-l-warning border-l-coollabs border-l-4" @endif + wire:loading.attr="disabled" type="{{ $type }}" @readonly($readonly) @disabled($disabled) id="{{ $htmlId }}" name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}" aria-placeholder="{{ $attributes->get('placeholder') }}"> @@ -65,10 +64,9 @@ class="absolute inset-y-0 right-0 flex items-center h-6 pt-2 pr-2 cursor-pointer