filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.07k stars 2.82k forks source link

Livewire overrides `disabled` attribute #7093

Closed zepfietje closed 1 year ago

zepfietje commented 1 year ago

wire:loading.attr="disabled" overrides conditional disabled state (found in at least checkbox list and radio components).

maharsh-mangal commented 1 year ago

@zepfietje hello, can i open a pr on this? i was going to make a branch and make one but i dont have permission. Can you direct me how to make contributions please if im missing something, thanks

zepfietje commented 1 year ago

Check out our contribution guide: https://github.com/filamentphp/filament#contributing.

maharsh-mangal commented 1 year ago

@zepfietje Please review my PR, thanks :)

sumardi commented 1 year ago

Do we still need wire:loading.attr="disabled" in form components? According to the docs,

Livewire automatically disables the submit button and all form inputs inside the

element while a wire:submit action is being processed. This ensures that a form isn't accidentally submitted twice.

saade commented 1 year ago

@sumardi not on fields I guess, but I think we need it in the submit button because other events can trigger a disabled state, like uploading a file through filepond for example

but good catch

sumardi commented 1 year ago

@sumardi not on fields I guess, but I think we need it in the submit button because other events can trigger a disabled state, like uploading a file through filepond for example

but good catch

filepond use alpine x-bind:disabled, not an issue if we remove wire:loading.attr="disabled". Because Livewire v3 automatically add disabled to submit button and readonly to form inputs.

saade commented 1 year ago

@sumardi not on fields I guess, but I think we need it in the submit button because other events can trigger a disabled state, like uploading a file through filepond for example but good catch

filepond use alpine x-bind:disabled, not an issue if we remove wire:loading.attr="disabled". Because Livewire v3 automatically add disabled to submit button and readonly to form inputs.

it uses x-bind:disabled only on the input IIRC, I think it does not apply to the submit button. The button should be disabled while uploading a file

zepfietje commented 1 year ago

There's a lot more cases than just fields inside forms. E.g. also text input columns on tables.

sakanjo commented 1 year ago

This bug is related to livewire v3, specifically wire-loading.js,

it should be fixed when the PR is merged.

example

danharrin commented 1 year ago

Thanks @sakanjo!

zepfietje commented 1 year ago

Confirmed the main issue been fixed by the Livewire PR @sakanjo created. Thanks!

It does seem, however, that the toggle doesn't honor the disabled state. Reopening https://github.com/filamentphp/filament/issues/7370.