diff --git a/Orange/canvas/document/schemeedit.py b/Orange/canvas/document/schemeedit.py index d2c68c53814..fc076c3c639 100644 --- a/Orange/canvas/document/schemeedit.py +++ b/Orange/canvas/document/schemeedit.py @@ -815,7 +815,7 @@ def removeSelected(self): selected = self.scene().selectedItems() if not selected: return - + scene = self.scene() self.__undoStack.beginMacro(self.tr("Remove")) for item in selected: if isinstance(item, items.NodeItem): @@ -824,6 +824,9 @@ def removeSelected(self): commands.RemoveNodeCommand(self.__scheme, node) ) elif isinstance(item, items.annotationitem.Annotation): + if item.hasFocus() or item.isAncestorOf(scene.focusItem()): + # Clear input focus from the item to be removed. + scene.focusItem().clearFocus() annot = self.scene().annotation_for_item(item) self.__undoStack.push( commands.RemoveAnnotationCommand(self.__scheme, annot)