Browse Source

Fixes #3887 issue with clicking element removed from DOM inside popup

pull/4074/head
Jack Lukic 9 years ago
parent
commit
b155731ec6
2 changed files with 11 additions and 4 deletions
  1. 2
      RELEASE-NOTES.md
  2. 13
      src/definitions/modules/popup.js

2
RELEASE-NOTES.md

@ -12,6 +12,8 @@
- **Modules** - Added new setting `silent` to all modules which allows you to disable **all** console output including errors. This can be useful for preventing known errors, like a popup which cannot place itself on screen, or `sticky` content which initializes before it is visible #3713
- **Dropdown** - All dropdowns, not just `selection dropdown`, will now select the first `menu item` that starts with a pressed keyboard key, for example "N" will select "New"
- **Build Tools** - Added new `autoInstall` option to allow for Semantic to be installed without user interaction. See [docs explanation](http://www.semantic-ui.com/introduction/advanced-usage.html#Auto-Install) for how to use. #3616 **Thanks @algorithme**
- **Popup** - Fixed issue where clicking element inside popup removed from DOM (like clicking a multi select label) would cause popup to close #3887
**Critical Bugs**
- **All UI** - Using `setting` on a setting that is an object literal, for example `error: {}` will now extend the existing object instead of replacing it.

13
src/definitions/modules/popup.js

@ -189,13 +189,18 @@ $.fn.popup = function(parameters) {
}
},
hideGracefully: function(event) {
let
$target = $(event.target),
isInDOM = $.contains(document.documentElement, event.target),
inPopup = ($target.closest(selector.popup).length > 0)
;
// don't close on clicks inside popup
if(event && $(event.target).closest(selector.popup).length === 0) {
module.debug('Click occurred outside popup hiding popup');
module.hide();
if(event && (!isInDOM || inPopup)) {
module.debug('Click was inside popup, keeping popup open');
}
else {
module.debug('Click was inside popup, keeping popup open');
module.debug('Click occurred outside popup hiding popup');
module.hide();
}
}
},

Loading…
Cancel
Save