From 6654db6bbf79dd2cc2aa207872c4db0d8c25d5c1 Mon Sep 17 00:00:00 2001 From: Mathieu Pillard Date: Thu, 5 Oct 2023 15:55:33 +0200 Subject: [PATCH] Fix modals to appear in fixed position, and ensure Android compat gets checked (#21279) * Fix modals to appear in fixed position, and ensure Android compat gets checked * No need to wrap this --- static/js/zamboni/devhub.js | 9 ++++++++- static/js/zamboni/global.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/static/js/zamboni/devhub.js b/static/js/zamboni/devhub.js index 3761c53ba8..df4f748d8a 100644 --- a/static/js/zamboni/devhub.js +++ b/static/js/zamboni/devhub.js @@ -1365,7 +1365,14 @@ function initSubmitModals() { return false; } if (confirmedOnce) { - $input.prop('checked', !$input.prop('checked')); + setTimeout(function () { + // $().modal() calls preventDefault() before firing the callback + // but the checkbox is temporarily checked anyway when clicking on + // it (not the label). To work around this, we wrap our toggling + // in a setTimeout() to force it to wait for the event to be + // processed. + $input.prop('checked', !$input.prop('checked')); + }, 0); } return !confirmedOnce; }, diff --git a/static/js/zamboni/global.js b/static/js/zamboni/global.js index 6aacb21a2b..671842ff96 100644 --- a/static/js/zamboni/global.js +++ b/static/js/zamboni/global.js @@ -311,7 +311,7 @@ $.fn.modal = function (click_target, o) { top: toY + 'px', right: 'inherit', bottom: 'inherit', - position: 'absolute', + position: 'fixed', }); return $modal; };