From 90a0c30e267c97122812c8275302e9e00ef90a12 Mon Sep 17 00:00:00 2001 From: Sahib Bhai Date: Tue, 19 Nov 2024 13:15:08 -0800 Subject: [PATCH] Add custom behavior to prevent focus on multiselect dropdown --- assets/javascript/custom.js | 11 +++++++++++ pages/components.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 assets/javascript/custom.js diff --git a/assets/javascript/custom.js b/assets/javascript/custom.js new file mode 100644 index 00000000..bf20bab2 --- /dev/null +++ b/assets/javascript/custom.js @@ -0,0 +1,11 @@ +document.addEventListener('DOMContentLoaded', function() { + const multiSelectDropdown = document.querySelector('.mantine-MultiSelect-dropdown'); + if (multiSelectDropdown) { + multiSelectDropdown.addEventListener('mousedown', function(event) { + // Prevent default focus behavior + event.preventDefault(); + // Set focus to another element (e.g., body) + document.body.focus(); + }); + } +}); \ No newline at end of file diff --git a/pages/components.py b/pages/components.py index 66575c7e..0a684d8a 100644 --- a/pages/components.py +++ b/pages/components.py @@ -234,7 +234,7 @@ def create_subtype_checklist(self): id='subtype_checklist', data=data, value=initial_values, - searchable=False, + searchable=True, nothingFoundMessage="No options found", clearable=True, style={"margin-bottom": "10px"},