summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-12-15 13:19:16 +0200
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-12-15 13:20:43 +0200
commit4794f672d61ea0186432d73d173c92e187dbdf04 (patch)
tree74de420dd49936d0983dc169a7abf2f3c5e29428 /client
parent05356b0cb628e7f7604991adf82387c746870104 (diff)
downloadvaadin-framework-4794f672d61ea0186432d73d173c92e187dbdf04.tar.gz
vaadin-framework-4794f672d61ea0186432d73d173c92e187dbdf04.zip
Prevent text selection on iOS devices with long tap (#19367)
Text or elements should not get selected when there's a context click listener. Pre-emptively prevent text selection for the whole widget when that happens. Change-Id: I3c09d8b2c25d383d6abe079f0fee3809cf5838c7
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/AbstractComponentConnector.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index f1ed0caf10..9a1c21d556 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -190,6 +190,10 @@ public abstract class AbstractComponentConnector extends AbstractConnector
final MouseEventDetails mouseEventDetails = MouseEventDetailsBuilder.buildMouseEventDetails(
event.getNativeEvent(), getWidget().getElement());
+ // Prevent selection for the element while pending long tap.
+ WidgetUtil.setTextSelectionEnabled(getWidget().getElement(),
+ false);
+
final EventTarget eventTarget = event.getNativeEvent()
.getEventTarget();
@@ -285,6 +289,8 @@ public abstract class AbstractComponentConnector extends AbstractConnector
*/
private void cancelTouchTimer() {
if (longTouchTimer != null) {
+ // Re-enable text selection
+ WidgetUtil.setTextSelectionEnabled(getWidget().getElement(), true);
longTouchTimer.cancel();
}
}