diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-12-16 14:57:58 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-12-18 11:44:18 +0000 |
commit | 2278f678fc9d3199825399b4bd3fba6659048877 (patch) | |
tree | 7f85289d1508924928f41a59acf6189a3e8f8b7b /client | |
parent | 158b83d98b99b61712bf79bdb710fd85bd691a3a (diff) | |
download | vaadin-framework-2278f678fc9d3199825399b4bd3fba6659048877.tar.gz vaadin-framework-2278f678fc9d3199825399b4bd3fba6659048877.zip |
Fix IE8 focus handling in Grid editor in unbuffered state (#19389)
Change-Id: Ia77c246239cae7b0add3c4975dfa5ffaa42d08b6
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 23 |
1 files changed, 22 insertions, 1 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); |