-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input field should be clearable even when disabled #838
Comments
For me the disabled state should disable all functionality of an element. Although semantically the
Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled#overview Strictly speaking a However, I think we can find a workaround for our use-case so should #627 get reverted it's not going to be a big deal for us. |
Ah, I see now where the I can do either way, kind of already did a quick workaround that looks the same as before but the disabled state is div that wraps around. {{-- Temporary workaround, notably - the wire:click event --}}
<flux:text class="rounded-lg border-solid border border-zinc-200 h-10 py-2 pl-3 pr-10 relative">
<span class="text-zinc-800 dark:text-white">{{$display}}</span>
<div class="absolute top-0 bottom-0 flex items-center justify-center pr-2 right-0">
<flux:button
:size="'sm'" tabindex="-1"
class="-mr-1" aria-label="{{__('Clear input')}}"
square="true" variant="subtle"
wire:click="$set('display','')"
>
<flux:icon.x-mark variant="micro" />
</flux:button>
</div>
</flux:text>
{{-- <flux:input disabled clearable wire:model.live="display" />--}} For me, the X inside feels and looks better, especially on the touchscreen |
I use a component (non-flux) in one of my apps the same way. When a client is selected, the input is disabled (so they can't click and the dropdown won't open) and the clear button is active. But then when they click clear, the selected value is cleared and the input becomes enabled again and the dropdown can be accessed again. I've not converted this app to Flux yet, so haven't run into this. So personally I'd love to have support for it, but definitely understand if it's preferred not to 🙂 |
Flux version
v1.0.29
Livewire version
v3.5.15
What is the problem?
It should be possible to set the input as
clearable
even when it isdisabled
.A recent update (discussed in #627) introduced a feature, where the
disabled
field would hide theclearable
icon.But there are still use cases where one would want input that is not editable yet clearable with the X mark. This enables i.e. to display a search box only when input is empty.
Code snippets
How do you expect it to work?
While I see the point in #627, I think, it should work in a way that:
clearable
is not set (null
), it auto-hides the clearable element based on thedisabled
stateclearable
is explicitly set (true or false) then it follows that no matter what isdisabled state
Please confirm (incomplete submissions will not be addressed)
The text was updated successfully, but these errors were encountered: