From 43fbdc63f64d6b3295e4f111e494748772ea1d69 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Wed, 20 Oct 2021 16:45:51 +0200 Subject: [PATCH] fix: [ui:select2] Fixed z-index issue By attaching it to the modal body if applicable --- plugins/Tags/webroot/js/tagging.js | 2 ++ webroot/css/main.css | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/Tags/webroot/js/tagging.js b/plugins/Tags/webroot/js/tagging.js index 606ad21..bcd9c3d 100644 --- a/plugins/Tags/webroot/js/tagging.js +++ b/plugins/Tags/webroot/js/tagging.js @@ -119,8 +119,10 @@ function initSelect2Picker($select) { } return buildTag(state) } + const $modal = $select.closest('.modal') $select.select2({ + dropdownParent: $modal.length != 0 ? $modal.find('.modal-body') : $(document.body), placeholder: 'Pick a tag', tags: true, width: '100%', diff --git a/webroot/css/main.css b/webroot/css/main.css index 8003ccc..a4715a0 100644 --- a/webroot/css/main.css +++ b/webroot/css/main.css @@ -94,7 +94,7 @@ input[type="checkbox"]:disabled.change-cursor { } .select2-container { - z-index: 1056; + z-index: 900; } .select2-container--bootstrap-5 {