summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java23
-rw-r--r--uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java26
2 files changed, 41 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 28c26893ef..f96ee69010 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -1248,6 +1248,23 @@ public class Grid<T> extends ResizeComposite implements
private static final String ERROR_CLASS_NAME = "error";
private static final String NOT_EDITABLE_CLASS_NAME = "not-editable";
+ ScheduledCommand fieldFocusCommand = new ScheduledCommand() {
+ private int count = 0;
+
+ @Override
+ public void execute() {
+ Element focusedElement = WidgetUtil.getFocusedElement();
+ if (focusedElement == grid.getElement()
+ || focusedElement == Document.get().getBody()
+ || count > 2) {
+ focusColumn(focusedColumnIndex);
+ } else {
+ ++count;
+ Scheduler.get().scheduleDeferred(this);
+ }
+ }
+ };
+
/**
* A handler for events related to the Grid editor. Responsible for
* opening, moving or closing the editor based on the received event.
@@ -1807,7 +1824,11 @@ public class Grid<T> extends ResizeComposite implements
}
if (i == focusedColumnIndex) {
- focusColumn(focusedColumnIndex);
+ if (BrowserInfo.get().isIE8()) {
+ Scheduler.get().scheduleDeferred(fieldFocusCommand);
+ } else {
+ focusColumn(focusedColumnIndex);
+ }
}
} else {
cell.addClassName(NOT_EDITABLE_CLASS_NAME);
diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java
index eaa58254ba..c4d1893875 100644
--- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java
+++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridEditorUnbufferedTest.java
@@ -83,12 +83,17 @@ public class GridEditorUnbufferedTest extends GridEditorTest {
}
@Test
- public void testEditorMoveWithKeyboard() {
+ public void testEditorMoveWithKeyboard() throws InterruptedException {
selectMenuPath(EDIT_ITEM_100);
assertEditorOpen();
- getGridElement().sendKeys(Keys.ENTER);
+ getEditorWidgets().get(0).click();
+ new Actions(getDriver()).sendKeys(Keys.ENTER).perform();
+
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ sleep(300);
+ }
String firstFieldValue = getEditorWidgets().get(0)
.getAttribute("value");
@@ -96,11 +101,18 @@ public class GridEditorUnbufferedTest extends GridEditorTest {
firstFieldValue);
for (int i = 0; i < 10; i++) {
- getGridElement().sendKeys(Keys.SHIFT, Keys.ENTER);
- }
+ new Actions(getDriver()).keyDown(Keys.SHIFT).sendKeys(Keys.ENTER)
+ .keyUp(Keys.SHIFT).perform();
- firstFieldValue = getEditorWidgets().get(0).getAttribute("value");
- assertEquals("Editor should move to row 91", "(91, 0)", firstFieldValue);
+ if (BrowserUtil.isIE8(getDesiredCapabilities())) {
+ sleep(300);
+ }
+
+ firstFieldValue = getEditorWidgets().get(0).getAttribute("value");
+ int row = 100 - i;
+ assertEquals("Editor should move to row " + row,
+ "(" + row + ", 0)", firstFieldValue);
+ }
}
@Test
@@ -133,7 +145,7 @@ public class GridEditorUnbufferedTest extends GridEditorTest {
getGridElement().getCell(10, 0).click();
- assertEquals("Editor should not to row 10", "(10, 0)",
+ assertEquals("Editor should move to row 10", "(10, 0)",
getEditorWidgets().get(0).getAttribute("value"));
}