From ecaa646e820b55cd2f1317119f75166f2a321f1f Mon Sep 17 00:00:00 2001 From: Mathieu Pillard Date: Tue, 10 Oct 2023 14:45:38 +0200 Subject: [PATCH] Trigger change event to reset custom validity when Firefox for Android is checked (#21295) The modal calls e.preventsDefault(), so the click never goes through, preventing change event from firing normally, which in turn leaves our custom validity enabled and triggers a validation error on submit. Manually triggering change works around this --- static/js/zamboni/devhub.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/js/zamboni/devhub.js b/static/js/zamboni/devhub.js index fb4dc740c8..f5f6c5d7e1 100644 --- a/static/js/zamboni/devhub.js +++ b/static/js/zamboni/devhub.js @@ -1372,6 +1372,7 @@ function initSubmitModals() { // in a setTimeout() to force it to wait for the event to be // processed. $input.prop('checked', !$input.prop('checked')); + $input.trigger('change'); }, 0); } return !confirmedOnce; @@ -1383,6 +1384,7 @@ function initSubmitModals() { .on('submit', function onSubmit(e) { e.preventDefault(); $input.prop('checked', true); + $input.trigger('change'); $modalAndroidConfirm.trigger('close'); confirmedOnce = true; });