Closed generator85 closed 1 year ago
I don't quite understand the issue. Maybe a video would help. And a repo that reproduces the issue.
What do you mean by ... will be validated again right after submit
? Fields are only validated when you submit the form.
Or do you have real-time validation turned on? If so, try disabling it. Then your fields won't be validated immediately but only when submitting the form.
When disabling realtime validation the issue is still there (the field is not validated in this case, but the success message disappears after a few millisecond after submit and I can see Livewire making two consecutive contact-form requests). I'm a bit hesitant to post a video since autocomplete shows my personal info, but I'll try to create a repo to reproduce this later.
[edit]I've edited my post to say autofill to avoid confusion with autocomplete[/edit]
I do think the issue is more related to Safari Autofill than with AlpineJS. You can try this as a test (no Alpine needed):
It looks like this is an issue with Livewire, Alpine, and Safari unrelated to this addon. This addon uses basic Livewire functionality and doesn't do anything fancy. So your issue likely has to be addressed by Livewire or Alpine. There are a couple of issues on the Livewire repo that sound similar to what you are describing: https://github.com/livewire/livewire/discussions?discussions_q=is%3Aopen+safari+autofill
If you come to the conclusion, that your issue in fact is a bug of this addon, feel free to respond with your reasoning. For now, I will close this issue.
I have this weird issue, where fields that were filled using Safari autofill will be validated again right after submit. When these fields required, a error will be shown because now the field are empty.
The weird thing is that this issue only arrises when I have a AlpineJS
x-data
property on the field. Also when entering text using the keyboard everything works as expected.Here is my
input.blade.php
file for my custom theme. The reason I added Alpine is because I need a class on the wrapper when the input is focused or has a value.As a quick fix, is it possible to disable validation after submit? I've tried overwriting the
updated
function in theBaseForm
class so it doesn't validate after submit. This stops the error message from showing up, but the success message will still disappear .