Skip to content

Commit

Permalink
fix: final and proper fix for modal backdrop for iOS devices
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Aug 14, 2024
1 parent 2c463fe commit 585f025
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion assets/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ window.onloadTurnstileCallback = function () {

// <https://stackoverflow.com/questions/10636667/bootstrap-modal-appearing-under-background/15780841#comment62524384_15780841>
$body.on('show.bs.modal', function (ev) {
$(ev.relatedTarget.attributes['data-target'].value).appendTo('body');
let { target } = ev;
if (!target && ev.relatedTarget) target = $(ev.relatedTarget).data('target');
if (!target) return;
// if the target is not in `<main>` or `<body>` then move it
const $el = $(target);
if ($el.length === 0) return;
if ($el.parent().is('body') || $el.parent().is('main')) return;
$el.appendTo('body');
});

// Re-render dates with user's local time
Expand Down

0 comments on commit 585f025

Please sign in to comment.