]> source.dussan.org Git - vaadin-framework.git/commitdiff
Explicitly focus widget when simulating click (#8659)
authorLeif Åstrand <leif@vaadin.com>
Wed, 25 Apr 2012 11:54:50 +0000 (11:54 +0000)
committerLeif Åstrand <leif@vaadin.com>
Wed, 25 Apr 2012 11:54:50 +0000 (11:54 +0000)
svn changeset:23628/svn branch:6.8

src/com/vaadin/terminal/gwt/client/Util.java

index b9baf362e473d97b1a842f681a10e668a18ac644..cb2539daa5943ef79ee6cc1ebfeedeb57f9c8740 100644 (file)
@@ -1223,6 +1223,19 @@ public class Util {
          */
         final Element target = getElementFromPoint(touch.getClientX(),
                 touch.getClientY());
+
+        /*
+         * Fixes infocusable form fields in Safari of iOS 5.x and some Android
+         * browsers.
+         */
+        Widget targetWidget = findWidget(target, null);
+        if (targetWidget instanceof com.google.gwt.user.client.ui.Focusable) {
+            final com.google.gwt.user.client.ui.Focusable toBeFocusedWidget = (com.google.gwt.user.client.ui.Focusable) targetWidget;
+            toBeFocusedWidget.setFocus(true);
+        } else if (targetWidget instanceof Focusable) {
+            ((Focusable) targetWidget).focus();
+        }
+
         Scheduler.get().scheduleDeferred(new ScheduledCommand() {
             public void execute() {
                 try {