From b48be91ec5d27cd129366fd179bbe59cb8603bab Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 19 Jul 2024 08:51:48 +0100 Subject: [PATCH] Fix tiddlers should not be interactive after being closed (#8344) * Initial Commit * Revert "Initial Commit" This reverts commit 25edf0e2129195f9d8e59bbdd3ca5dc56d67f9a4. * Alternative fix --- core/modules/storyviews/classic.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/modules/storyviews/classic.js b/core/modules/storyviews/classic.js index c2848c435..044cd97f0 100644 --- a/core/modules/storyviews/classic.js +++ b/core/modules/storyviews/classic.js @@ -82,6 +82,10 @@ ClassicStoryView.prototype.remove = function(widget) { removeElement = function() { widget.removeChildDomNodes(); }; + // Blur the focus if it is within the descendents of the node we are removing + if($tw.utils.domContains(targetElement,targetElement.ownerDocument.activeElement)) { + targetElement.ownerDocument.activeElement.blur(); + } // Abandon if the list entry isn't a DOM element (it might be a text node) if(!targetElement || targetElement.nodeType === Node.TEXT_NODE) { removeElement();