From 7c767557db2a5d28f72c43919db0f284f24e1abd Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 1 Aug 2019 15:12:05 +0200 Subject: [roomplanner] Ugly workaround for modal-close-bug on Firefox --- modules-available/roomplanner/clientscript.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules-available/roomplanner/clientscript.js b/modules-available/roomplanner/clientscript.js index 48311a09..0ad14a25 100644 --- a/modules-available/roomplanner/clientscript.js +++ b/modules-available/roomplanner/clientscript.js @@ -11,7 +11,7 @@ var selectMachinInitialized = false; var placedMachines = []; -var $modal, $selectizeSearch; +var $modal, $selectizeSearch, $selectizeSubnet; var currentCallback = false; function makeCombinedFieldSingle(item) @@ -118,6 +118,18 @@ function initSelectize() { /* init modal */ $modal = $('#selectMachineModal'); + // Firefox workaround - don't close the modal when selecting an item from the dropdown + // A proper fix for the underlying cause would be much appreciated + var selectTime = 0; + var ch = function() { + selectTime = Date.now(); + }; + $modal.on('hide.bs.modal', function(e) { + if (Date.now() - selectTime < 400) { + e.preventDefault(); + } + }); + /* for the search */ $selectizeSearch = $('#machineSearchBox').selectize({ plugins : ["remove_button"], @@ -130,6 +142,7 @@ function initSelectize() { maxItems: 1, sortField: 'sortField', sortDirection: 'asc', + onDropdownClose: ch, onChange: clearSubnetBox }); @@ -146,6 +159,7 @@ function initSelectize() { maxItems: 1, sortField: 'sortField', sortDirection: 'asc', + onDropdownClose: ch, onChange: clearSearchBox }); @@ -154,6 +168,7 @@ function initSelectize() { selectMachinInitialized = true; } } + function onBtnSelect() { /* check which one has a value */ console.assert($selectizeSubnet.length === 1); -- cgit v1.2.3-55-g7522