-
Notifications
You must be signed in to change notification settings - Fork 13
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
onautocomplete triggered on checkbox toggle #49
Comments
Same issue. I think it's related to bootstrap's styles in my case. Solved after deleting [Edit] |
The issue is not related to boostrap or to css classes in general. It's because of this line in the onInput event handler: ('insertReplacementText' === event.inputType || !('data' in event)) ? This is for the input event, which is registered like this: document.addEventListener('input', onInput, true); For radio buttons and checkboxes (the issue is also applicable to radios), there's no 'data' property in the event object, therefore it assumes autocomplete. That's because "data" holds characters entered, and neither checkboxes, nor radio buttons have this. I think in order to make this more resilient, instead of checking for data in event, the code should check if there was a previous focus or a mousedown (as in ... right before the input event, in a small time interval). This will work for both inputs ad well as radio buttons and checkboxes, when they are autofilled. let lastClickTime = 0; document.addEventListener('mousedown', function() { function onInput(event) { |
Describe the bug
For some reason the onautocomplete triggered whenever I clicked on a checkbox in my form, I've had to disable it for now.
Expected behavior
No event triggered on checkbox toggle
Desktop (please complete the following information):
MacOS
Chrome Version 102.0.5005.61 (Official Build) (arm64)
The text was updated successfully, but these errors were encountered: