summaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorAnastasia Smirnova <anasmi@utu.fi>2018-05-03 13:07:29 +0300
committerIlia Motornyi <elmot@vaadin.com>2018-05-03 13:07:29 +0300
commitd65325e326f40e6e9abd3b7f62493e3314e788b5 (patch)
tree8a46ace98f3a1f7ce6290f98a3e7d2085830c62e /client/src
parent1d6002baf96ec0cc4cb6aff7336af8fa94f57c63 (diff)
downloadvaadin-framework-d65325e326f40e6e9abd3b7f62493e3314e788b5.tar.gz
vaadin-framework-d65325e326f40e6e9abd3b7f62493e3314e788b5.zip
Allow focus to another component, when closing the window (#10860)
Resolves #5891
Diffstat (limited to 'client/src')
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VWindow.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VWindow.java b/client/src/main/java/com/vaadin/client/ui/VWindow.java
index c0b3f69289..f7fc2ba6b8 100644
--- a/client/src/main/java/com/vaadin/client/ui/VWindow.java
+++ b/client/src/main/java/com/vaadin/client/ui/VWindow.java
@@ -253,11 +253,16 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
* Restores the previously stored focused element.
*
* When the focus was changed outside the window while the window was
- * open, the originally stored element is restored.
+ * open, the originally stored element is not restored.
+ *
+ * IE returns null and other browsers HTMLBodyElement, if no element is
+ * focused after window is closed.
*/
- getApplicationConnection().getUIConnector().getWidget()
- .focusStoredElement();
-
+ if (WidgetUtil.getFocusedElement() == null || "body".equalsIgnoreCase(
+ WidgetUtil.getFocusedElement().getTagName())) {
+ getApplicationConnection().getUIConnector().getWidget()
+ .focusStoredElement();
+ }
removeTabBlockHandlers();
// If you click while the window is being closed,
// a new dragging curtain might be added and will
@@ -725,8 +730,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
hideDraggingCurtain();
hideResizingCurtain();
}
- super.hide(false, true, false);
-
+ super.hide();
int curIndex = getWindowOrder();
// Remove window from windowOrder to avoid references being left
// hanging.