diff options
author | Anastasia Smirnova <anasmi@utu.fi> | 2018-05-03 13:07:29 +0300 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-05-03 13:07:29 +0300 |
commit | d65325e326f40e6e9abd3b7f62493e3314e788b5 (patch) | |
tree | 8a46ace98f3a1f7ce6290f98a3e7d2085830c62e /client/src | |
parent | 1d6002baf96ec0cc4cb6aff7336af8fa94f57c63 (diff) | |
download | vaadin-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.java | 16 |
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. |