summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2015-07-15 20:37:20 +0300
committerMika Murtojarvi <mika@vaadin.com>2015-08-04 14:14:24 +0300
commitae9adec0467ea88fd12e0295791b77f5ef3010ae (patch)
tree7f3347339a5f6450a56f43046899a97bab1ccba1 /client
parent951101ce39620501ed8aa1751909b7bc697713a3 (diff)
downloadvaadin-framework-ae9adec0467ea88fd12e0295791b77f5ef3010ae.tar.gz
vaadin-framework-ae9adec0467ea88fd12e0295791b77f5ef3010ae.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: I46598243d1022b82cf64f0e60169f52248c3cc72
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VUI.java10
-rw-r--r--client/src/com/vaadin/client/ui/VWindow.java21
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() {