diff options
author | Artur Signell <artur@vaadin.com> | 2015-07-15 20:37:20 +0300 |
---|---|---|
committer | patrik <patrik@vaadin.com> | 2015-08-04 15:49:48 +0300 |
commit | 3fe71f11c96105bb0fad1269e96eceec86711927 (patch) | |
tree | 572fe67fa5d011288ebe8fe8e5527d2fbe160510 /client | |
parent | 5f091ed65d0e76c43ae70fc1db11a17256305b65 (diff) | |
download | vaadin-framework-3fe71f11c96105bb0fad1269e96eceec86711927.tar.gz vaadin-framework-3fe71f11c96105bb0fad1269e96eceec86711927.zip |
Ensure server side focus is applied when opening a window (#17731)
This change removes all deferred commands for handling window focus to
ensure
the focus events are triggered in the expected order
Change-Id: Ie3295aa8825f5c1c16d15f3deded987beb34d5fd
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VUI.java | 10 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 21 |
2 files changed, 10 insertions, 21 deletions
diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index 0c1b83ab0f..963d83a6e6 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -18,7 +18,6 @@ package com.vaadin.client.ui; import java.util.ArrayList; -import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.HasScrollHandlers; @@ -44,8 +43,8 @@ import com.vaadin.client.ConnectorMap; import com.vaadin.client.Focusable; import com.vaadin.client.LayoutManager; import com.vaadin.client.Profiler; -import com.vaadin.client.WidgetUtil; import com.vaadin.client.VConsole; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; import com.vaadin.client.ui.ui.UIConnector; @@ -515,13 +514,6 @@ public class VUI extends SimplePanel implements ResizeHandler, public void focusStoredElement() { if (storedFocus != null) { storedFocus.focus(); - - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - @Override - public void execute() { - storedFocus.focus(); - } - }); } } diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index e5e09f9f09..e34e12a20b 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -562,17 +562,10 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, } private static void focusTopmostModalWindow() { - // If we call focus() directly without scheduling, it does not work in - // IE and FF. - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - @Override - public void execute() { - VWindow topmost = getTopmostWindow(); - if ((topmost != null) && (topmost.vaadinModality)) { - topmost.focus(); - } - } - }); + VWindow topmost = getTopmostWindow(); + if ((topmost != null) && (topmost.vaadinModality)) { + topmost.focus(); + } } @Override @@ -1373,7 +1366,11 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner, @Override public void focus() { - contentPanel.focus(); + // We don't want to use contentPanel.focus() as that will use a timer in + // Chrome/Safari and ultimately run focus events in the wrong order when + // opening a modal window and focusing some other component at the same + // time + contentPanel.getElement().focus(); } private int getDecorationHeight() { |