From 180a64626796a2a86862679ec69e8e9f0fa9a1da Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Sat, 12 Oct 2024 21:06:52 +0100 Subject: [PATCH] remove select2 dependence on 'dropdownParent' fixes an issue with dropdown options placement on smaller screens in modals. Instead of 'dropdownParent', just set the z-index of the dropdown options to 9999 - above the modal. --- apps/home/templates/home/modals/editFilter.html | 2 +- apps/home/templates/home/modals/editStyle.html | 4 ++-- apps/home/templates/home/modals/editSub.html | 8 ++++---- static/css/select2.css | 5 +++++ static/js/base.js | 4 +--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/home/templates/home/modals/editFilter.html b/apps/home/templates/home/modals/editFilter.html index 9c90ecc..64299c0 100644 --- a/apps/home/templates/home/modals/editFilter.html +++ b/apps/home/templates/home/modals/editFilter.html @@ -22,7 +22,7 @@
- +
The algorithm used to match against.
diff --git a/apps/home/templates/home/modals/editStyle.html b/apps/home/templates/home/modals/editStyle.html index 833ffc1..d5229c0 100644 --- a/apps/home/templates/home/modals/editStyle.html +++ b/apps/home/templates/home/modals/editStyle.html @@ -74,7 +74,7 @@
-
Modify the title in fun ways.
@@ -83,7 +83,7 @@
-
Modify the description in fun ways.
diff --git a/apps/home/templates/home/modals/editSub.html b/apps/home/templates/home/modals/editSub.html index c472684..4fc96f1 100644 --- a/apps/home/templates/home/modals/editSub.html +++ b/apps/home/templates/home/modals/editSub.html @@ -29,7 +29,7 @@
-
Appearance of delivered content.
@@ -44,21 +44,21 @@
- +
Send content to these channels.
- +
Filter out unwanted content.
- +
Rules on telling content apart.
diff --git a/static/css/select2.css b/static/css/select2.css index c13abe5..59a53ee 100644 --- a/static/css/select2.css +++ b/static/css/select2.css @@ -1,5 +1,10 @@ /* Select 2 */ +/* Keep the select2 options visible above modals */ +.select2-container--open { + z-index: 9999; +} + .select2-selection { background-color: var(--bs-body-bg) !important; font-size: 1rem !important; diff --git a/static/js/base.js b/static/js/base.js index 7ebe236..fdfb8ed 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -52,11 +52,9 @@ $(document).ready(function() { // Activate select2s $(".select-2").each(function() { - var dropdownParent = $(this).attr("data-dropdownparent"); $(this).select2({ theme: "bootstrap", - minimumResultsForSearch: 10, - dropdownParent: dropdownParent + minimumResultsForSearch: 10 }); });