1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 13:29:56 +00:00

Fix popups not being cancelled correctly (#4158)

This commit is contained in:
Simon Huber 2019-08-04 14:01:24 +02:00 committed by Jeremy Ruston
parent 8159c4a865
commit e1bb532d98

View File

@ -154,11 +154,12 @@ Detect if a Popup contains an input field that has focus
Returns true or false Returns true or false
*/ */
Popup.prototype.detectInputWithinPopup = function(node) { Popup.prototype.detectInputWithinPopup = function(node) {
var withinPopup = false; var withinPopup = false,
currNode = node;
for(var i=0; i<this.popups.length; i++) { for(var i=0; i<this.popups.length; i++) {
var popup = (this.popups[i] && this.popups[i].domNode) ? this.popups[i].domNode : null; var popup = (this.popups[i] && this.popups[i].domNode) ? this.popups[i].domNode : null;
while(node && popup) { while(node && popup) {
if(node === popup || (node.classList && (node.classList.contains("tc-popup-keep") || node.classList.contains("tc-popup-handle")))) { if(node === popup || (node.classList && (node.classList.contains("tc-popup-keep") || (node !== currNode && node.classList.contains("tc-popup-handle"))))) {
withinPopup = true; withinPopup = true;
} }
node = node.parentNode; node = node.parentNode;