S
SolidJS11mo ago
Baptiste

Autofill input does not trigger the `onInput` callback

I'm having a hard time understanding it. Probably related to https://github.com/solidjs/solid/discussions/416 ?
GitHub
input are not controlled by value · solidjs solid · Discussion #4...
IMPORTANT: If you have a question or an idea for a new feature use Github Discussions instead Describe the bug I passed a string as value into <input/>. when user type, I didn't change th...
4 Replies
Baptiste
BaptisteOP11mo ago
Basically this: https://playground.solidjs.com/anonymous/1278abab-a375-49de-ac8b-14e437819329 If a system autofills the input, then the submit button will stay disabled.
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
foolswisdom
foolswisdom11mo ago
This is a general browser issue, that there is no good way to detect autofill (I don't know if the controlled inputs in react solve this issue) The best way is really not to disable the button, just validate the inputs after the user presses it. I've been on many websites where (after autofill) I had to click in the input fields and leave again to enable the button
foolswisdom
foolswisdom11mo ago
As an alternative, you can use something like https://github.com/matteobad/detect-autofill which tries to handle the different ways each browser might indicate that an autofill happened
GitHub
GitHub - matteobad/detect-autofill: Small javascript library to det...
Small javascript library to detect browser autofill of form elements. Usefull for implementing floating labels or applying custom styles. - GitHub - matteobad/detect-autofill: Small javascript libr...
foolswisdom
foolswisdom11mo ago
The code there looks pretty simple actually
Want results from more Discord servers?
Add your server