-
Notifications
You must be signed in to change notification settings - Fork 45
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
Hitting backspace in an input inside a model with wire:model
closes the modal
#850
Comments
That's strange. I tried to replicate this in my test environment but I can't. I assume you checked the XHR-tab in your network requests already? Interesting to see what happens there. Does the |
@ju5t thanks for testing! Hmm 🤔 I tested it in two different repos. But it's possible I'm using a local version of Flux that might have changes. Just double checked and there was no network request. But I did just notice this... It seems like the input events that the input are firing are bubbling up to the modal and the modal is receiving the values. Using |
I can replicate it in a new installation somehow. But it looks like the solution is documented: If you change |
This goes back to this issue #66 |
@ju5t ah yep thanks! I do remember that now haha. I'm going to leave this open to see if we can find a better way to solve it as I'm sure it will trip other people up too. |
I've submitted a PR that adds PR description below. The scenarioIf you have a modal that is <?php
use Livewire\Volt\Component;
new class extends Component {
public $show = false;
};
?>
<div>
<flux:modal.trigger name="name-modal">
<flux:button variant="primary" size="sm">Show Modal</flux:button>
</flux:modal.trigger>
<flux:modal name="name-modal" wire:model="show" class="!w-full">
<flux:input wire:model="name" label="Name" />
</flux:modal>
</div> The problemThis happens because the input is dispatching an input event that is bubbling up to the Now we already have it documented that developers should use The solutionTo solve this permanently, I have update the modal component to detect if Now this does mean that someone won't be able to actually use If an issue does get raised though, we can always add a Fixes #850 |
Flux version
v1.0.29
Livewire version
v3.5.17
What is the problem?
If you have a modal that is
wire:model
to a property, and have an input inside the modal, entering anything into the input and then hitting backspace closes the modal.Copy the below Volt component and then:
Code snippets
How do you expect it to work?
It shouldn't close the modal!
Please confirm (incomplete submissions will not be addressed)
The text was updated successfully, but these errors were encountered: