]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix navigation using keyboard to frozen column when there are hidden columns (#8277)
authorArtur <artur@vaadin.com>
Thu, 19 Jan 2017 20:43:25 +0000 (22:43 +0200)
committerGitHub <noreply@github.com>
Thu, 19 Jan 2017 20:43:25 +0000 (22:43 +0200)
client/src/main/java/com/vaadin/client/widgets/Grid.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeaturesTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnResizeTest.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridKeyboardNavigationTest.java

index ebccfc292d38dfaf850a4140e99616906a1a84dc..69801fb0ffdee2d293778d82f262567cdfe54ac8 100755 (executable)
@@ -2587,9 +2587,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
                     ++i;
                 } while (cell != null);
             }
-            int columnIndex = getColumns()
-                    .indexOf(getVisibleColumn(columnIndexDOM));
-            if (columnIndex >= escalator.getColumnConfiguration()
+            if (columnIndexDOM >= escalator.getColumnConfiguration()
                     .getFrozenColumnCount()) {
                 escalator.scrollToColumn(columnIndexDOM, ScrollDestination.ANY,
                         10);
index 0c95e24700afa23305e08dadbb7d13c6fe53cc6e..6ee452c8643ffd625f6e0cd6492707f8de804c32 100644 (file)
@@ -251,4 +251,9 @@ public abstract class GridBasicFeaturesTest extends MultiBrowserTest {
         }
         return null;
     }
+
+    protected void toggleColumnHidden(int column) {
+        selectMenuPath("Component", "Columns", "Column " + column, "Hidden");
+    }
+
 }
index 0ed3de39d4b6d502267f03a8200a04065b256b78..28d5df339c1fb57c72bb009d799d88bc2dcfa234 100644 (file)
@@ -153,13 +153,13 @@ public class GridColumnResizeTest extends GridBasicFeaturesTest {
         selectMenuPath("Component", "Columns",
                 "Toggle all column hidden state");
         // Hides although already hidden
-        selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+        toggleColumnHidden(0);
         // Shows
-        selectMenuPath("Component", "Columns", "Column 0", "Hidden");
+        toggleColumnHidden(0);
         // Hides although already hidden
-        selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+        toggleColumnHidden(2);
         // Shows
-        selectMenuPath("Component", "Columns", "Column 2", "Hidden");
+        toggleColumnHidden(2);
         GridCellElement cell = getGridElement().getCell(0, 1);
         dragResizeColumn(1, 0, -cell.getSize().getWidth());
         assertGreaterOrEqual("Cell got too small.", cell.getSize().getWidth(),
index aacb32c98237a6584277555a5c71a376b35fe5e4..0717ab55925ee83d3285cb9fd1da15e5fce86389 100644 (file)
@@ -229,4 +229,18 @@ public class GridKeyboardNavigationTest extends GridBasicFeaturesTest {
                 column == focusedColumn
                         && Math.abs(row - focusedRow) <= rowTolerance);
     }
-}
\ No newline at end of file
+
+    @Test
+    public void testNavigateOverHiddenColumnToFrozenColumn() {
+        openTestURL();
+        setFrozenColumns(3);
+        toggleColumnHidden(1);
+        getGridElement().getCell(0, 2).click();
+        assertFocusedCell(0, 2);
+        new Actions(getDriver()).sendKeys(Keys.ARROW_LEFT).perform();
+        assertFocusedCell(0, 1);
+        new Actions(getDriver()).sendKeys(Keys.ARROW_LEFT).perform();
+        assertFocusedCell(0, 0);
+    }
+
+}