diff options
author | Artur Signell <artur@vaadin.com> | 2013-06-05 11:06:17 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-06-05 08:55:12 +0000 |
commit | 3c8a3bfcab674e791dc8e91ec5038b7e7e5257d0 (patch) | |
tree | 8a79b5cc0a0d9179f354350219cb8a9e0b5fe9f0 /client | |
parent | 1b85e5926a0375d87ac076391bfe9d5d0c034da9 (diff) | |
download | vaadin-framework-3c8a3bfcab674e791dc8e91ec5038b7e7e5257d0.tar.gz vaadin-framework-3c8a3bfcab674e791dc8e91ec5038b7e7e5257d0.zip |
Merge of properly focus clicked input element in Webkit (#11854, #11297)
Change-Id: I4c313b55966bcbcd31a40bdd0bf561e887822e51
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VCheckBox.java | 14 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VNativeButton.java | 12 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VOptionGroup.java | 13 |
3 files changed, 29 insertions, 10 deletions
diff --git a/client/src/com/vaadin/client/ui/VCheckBox.java b/client/src/com/vaadin/client/ui/VCheckBox.java index ca1e3ebcdb..166e9acbb4 100644 --- a/client/src/com/vaadin/client/ui/VCheckBox.java +++ b/client/src/com/vaadin/client/ui/VCheckBox.java @@ -16,10 +16,13 @@ package com.vaadin.client.ui; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Event; import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.Util; import com.vaadin.client.VTooltip; @@ -52,6 +55,17 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements (DOM.getEventsSunk(el) | VTooltip.TOOLTIP_EVENTS)); el = DOM.getNextSibling(el); } + + if (BrowserInfo.get().isWebkit()) { + // Webkit does not focus non-text input elements on click + // (#11854) + addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + setFocus(true); + } + }); + } } @Override diff --git a/client/src/com/vaadin/client/ui/VNativeButton.java b/client/src/com/vaadin/client/ui/VNativeButton.java index 6e1c5bae77..67fa6f2ee3 100644 --- a/client/src/com/vaadin/client/ui/VNativeButton.java +++ b/client/src/com/vaadin/client/ui/VNativeButton.java @@ -16,14 +16,9 @@ package com.vaadin.client.ui; -import com.google.gwt.core.client.Scheduler; -import com.google.gwt.core.client.Scheduler.ScheduledCommand; -import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.MouseEvent; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Button; @@ -31,7 +26,6 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.BrowserInfo; import com.vaadin.client.MouseEventDetailsBuilder; import com.vaadin.client.Util; -import com.vaadin.client.VConsole; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.ui.button.ButtonServerRpc; @@ -149,8 +143,10 @@ public class VNativeButton extends Button implements ClickHandler { return; } - if (BrowserInfo.get().isSafari()) { - VNativeButton.this.setFocus(true); + if (BrowserInfo.get().isWebkit()) { + // Webkit does not focus non-text input elements on click + // (#11854) + setFocus(true); } if (disableOnClick) { setEnabled(false); diff --git a/client/src/com/vaadin/client/ui/VOptionGroup.java b/client/src/com/vaadin/client/ui/VOptionGroup.java index 2ba8a9e729..ca1f19303d 100644 --- a/client/src/com/vaadin/client/ui/VOptionGroup.java +++ b/client/src/com/vaadin/client/ui/VOptionGroup.java @@ -40,6 +40,7 @@ import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.Widget; import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.shared.EventId; @@ -153,8 +154,16 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler, public void onClick(ClickEvent event) { super.onClick(event); if (event.getSource() instanceof CheckBox) { - final boolean selected = ((CheckBox) event.getSource()).getValue(); - final String key = optionsToKeys.get(event.getSource()); + CheckBox source = (CheckBox) event.getSource(); + + if (BrowserInfo.get().isWebkit()) { + // Webkit does not focus non-text input elements on click + // (#11854) + source.setFocus(true); + } + + final boolean selected = source.getValue(); + final String key = optionsToKeys.get(source); if (!isMultiselect()) { selectedKeys.clear(); } |