-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix annoying areYouSure confirm caused by Chrome auto filling (failed trial) #17267
Conversation
web_src/js/index.js
Outdated
// so we can just wait for a few seconds, then the changes of the inputs are sure to be caused by real users. | ||
setTimeout(() => { | ||
$('form:not(.ignore-dirty)').areYouSure(); | ||
}, 3000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't something like 1 second shouldn't be enough? 3 seconds seems a bit too much imho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it doesn't differ much for real users. 3 second is safer to make Chrome do its private operations.
No user would complete a complex form in 3 seconds. If he/she can complete a form in 3 seconds, then he/she won't worry about the lost of the content because the content can be re-filled in another 3 seconds very soon. 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but if you edit form it could be also simple checkbox that needs to be changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will try more, and I find a new problem about auto filling ...
// Chrome always auto fills some inputs, and triggers `areYouSure` confirm when leaving, `autocomplete=off` doesn't help at all. | ||
// so we can just wait for a few seconds, then the changes of the inputs are sure to be caused by real users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Chrome always auto fills some inputs, and triggers `areYouSure` confirm when leaving, `autocomplete=off` doesn't help at all. | |
// so we can just wait for a few seconds, then the changes of the inputs are sure to be caused by real users. | |
// Prevent confirm dialog from triggering on browser auto-fill |
Autofill is not Chrome-specific and I think this comment is descriptive enough
// so we can just wait for a few seconds, then the changes of the inputs are sure to be caused by real users. | ||
setTimeout(() => { | ||
$('form:not(.ignore-dirty)').areYouSure(); | ||
}, 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, 1000); | |
}, 2000); |
Maybe a better compromise. I for example use BitWarden to autofill and it certainly has a bit of delay to it where 1s might not suffice. If we could somehow detect autofill, that would be an even better option but I'm not sure if it's possible.
Autofill detection might be possible by monitoring for an |
I meet a new problem. Chrome is really annoying. I am thinking about a totally new solution ....
|
Maybe https://github.com/matteobad/detect-autofill is useful, but it looks to be quite a hack. |
After some investigation, the solutions all seem very hacky, so I think we had better close this PR and to see whether there are better solutions. |
Closes #16861
Chrome always auto fills some inputs, and triggers
areYouSure
confirm when leaving,autocomplete=off
doesn't help at all (see the screenshots in the issue above, even if there isautocomplete=off
, Chrome still auto fills)So we can just wait for a few seconds, then the changes of the inputs are sure to be caused by real users.
Tested and it works as expected.