summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-01-23 12:32:41 +0200
committerJohannes Dahlström <johannesd@vaadin.com>2015-01-26 10:24:20 +0000
commit425e91b77da4b7078a9ab1a4df141c3de71de355 (patch)
tree55e5d7cd150bb7e692983cc1fb6ead580fce0589
parent4136d84671305e96358b50b0e6d6f996444bf9a7 (diff)
downloadvaadin-framework-425e91b77da4b7078a9ab1a4df141c3de71de355.tar.gz
vaadin-framework-425e91b77da4b7078a9ab1a4df141c3de71de355.zip
Prevent text selection when multi sorting with header clicks (#16275)
Change-Id: I294b60f9aa613bc976adcc1d265e4b260dda1876
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 980261c452..9445ab77fb 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -3506,7 +3506,8 @@ public class Grid<T> extends ResizeComposite implements
// Sink header events and key events
sinkEvents(getHeader().getConsumedEvents());
sinkEvents(Arrays.asList(BrowserEvents.KEYDOWN, BrowserEvents.KEYUP,
- BrowserEvents.KEYPRESS, BrowserEvents.DBLCLICK));
+ BrowserEvents.KEYPRESS, BrowserEvents.DBLCLICK,
+ BrowserEvents.MOUSEDOWN));
// Make ENTER and SHIFT+ENTER in the header perform sorting
addHeaderKeyUpHandler(new HeaderKeyUpHandler() {
@@ -4740,6 +4741,12 @@ public class Grid<T> extends ResizeComposite implements
return false;
}
+ if (BrowserEvents.MOUSEDOWN.equals(event.getType())
+ && event.getShiftKey()) {
+ // Don't select text when shift clicking on a header.
+ event.preventDefault();
+ }
+
if (BrowserEvents.TOUCHSTART.equals(event.getType())) {
if (event.getTouches().length() > 1) {
return false;