From ca26be80d32aa5281552fba3d413fb65e66c5489 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 8 Oct 2021 17:31:38 +0800 Subject: [PATCH 1/2] Fix annoying areYouSure confirm caused by Chrome auto filling --- web_src/js/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 4fda303a3ca50..53694c80a838a 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2969,7 +2969,11 @@ $(() => { // Warn users that try to leave a page after entering data into a form. // Except on sign-in pages, and for forms marked as 'ignore-dirty'. if ($('.user.signin').length === 0) { - $('form:not(.ignore-dirty)').areYouSure(); + // 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. + setTimeout(() => { + $('form:not(.ignore-dirty)').areYouSure(); + }, 3000); } // Parse SSH Key From 0446a6551755cb25f671441b4ea73f324a83469f Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 8 Oct 2021 18:17:30 +0800 Subject: [PATCH 2/2] set timer to 1000ms (from 3000ms) --- web_src/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 53694c80a838a..b0cc127c89c77 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2973,7 +2973,7 @@ $(() => { // 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); + }, 1000); } // Parse SSH Key