From 568858cc9b2f2ce66544a5e9dec7c7226a7b568a Mon Sep 17 00:00:00 2001 From: Marco 'Lubber' Wienkoop Date: Thu, 25 Jul 2019 09:22:43 +0200 Subject: [PATCH] fix(dropdown): only preventdefault on hide for associating labels The implemented preventDefault avoided a dropdown by reopening when clicking on the associated label instead of the dropdown itself. Unfortunately this also stops other events in some situations which do not belong to the dropdown itself. This PR now only prevents the event when the special case of the associated label was the target. Closes #861 --- src/definitions/modules/dropdown.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/definitions/modules/dropdown.js b/src/definitions/modules/dropdown.js index 0d595339b7..9462556972 100644 --- a/src/definitions/modules/dropdown.js +++ b/src/definitions/modules/dropdown.js @@ -1201,7 +1201,9 @@ $.fn.dropdown = function(parameters) { }, hide: function(event) { if(module.determine.eventInModule(event, module.hide)){ + if(element.id && $(event.target).attr('for') === element.id){ event.preventDefault(); + } } } },