mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-05-02 03:22:40 +02:00
fix(regions): reset backdrop inline z-index on hide so picker stays clickable
Bootstrap reuses the same .modal-backdrop element across show/hide cycles. The previous stacked-modal fix bumped its z-index to 1065 inline but never cleaned it up, so the next non-stacked open of the picker (e.g. via the status-bar badge) reused that 1065 backdrop above the default-1055 modal, covering the entire viewport with an unclickable overlay. Capture the bumped backdrop reference in onShown and clear its inline z-index in onHidden alongside the modal's. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -3007,15 +3007,24 @@ async function openRegionPicker(channelIdx) {
|
||||
const modalEl = document.getElementById('regionPickerModal');
|
||||
// Stacked-modal fix: when opened on top of Manage Channels, bump z-index so
|
||||
// the new backdrop dims the channels modal underneath instead of sliding behind it.
|
||||
// Bootstrap reuses the same backdrop element across show/hide cycles, so we must
|
||||
// also reset its inline z-index on hide — otherwise the next non-stacked open
|
||||
// inherits z-index 1065 and the backdrop ends up above the modal, blocking clicks.
|
||||
let bumpedBackdrop = null;
|
||||
const onShown = () => {
|
||||
const backdrops = document.querySelectorAll('.modal-backdrop');
|
||||
if (backdrops.length > 1) {
|
||||
modalEl.style.zIndex = '1075';
|
||||
backdrops[backdrops.length - 1].style.zIndex = '1065';
|
||||
bumpedBackdrop = backdrops[backdrops.length - 1];
|
||||
bumpedBackdrop.style.zIndex = '1065';
|
||||
}
|
||||
};
|
||||
const onHidden = () => {
|
||||
modalEl.style.zIndex = '';
|
||||
if (bumpedBackdrop) {
|
||||
bumpedBackdrop.style.zIndex = '';
|
||||
bumpedBackdrop = null;
|
||||
}
|
||||
modalEl.removeEventListener('shown.bs.modal', onShown);
|
||||
modalEl.removeEventListener('hidden.bs.modal', onHidden);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user