Always prevent default event delivery on keys If we matched a key binding, we want to steal that from the browser agent and never permit it to use its default action. Change-Id: I245b99ab0d890573571184f89599718e1be70ce7 Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/pom.xml b/pom.xml index 80aee55..59efaf1 100644 --- a/pom.xml +++ b/pom.xml
@@ -21,7 +21,7 @@ <groupId>gwtexpui</groupId> <artifactId>gwtexpui</artifactId> <packaging>jar</packaging> - <version>1.2.1</version> + <version>1.2.2</version> <name>gwtexpui</name> <description>Extended UI tools for GWT</description> <url>http://android.git.kernel.org/?p=tools/gwtexpui.git</url>
diff --git a/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java b/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java index b2a0f93..05d0104 100644 --- a/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java +++ b/src/main/java/com/google/gwtexpui/globalkey/client/KeyCommandSet.java
@@ -112,6 +112,7 @@ public void onKeyPress(final KeyPressEvent event) { final KeyCommand k = map.get(toMask(event)); if (k != null) { + event.preventDefault(); event.stopPropagation(); k.onKeyPress(event); }
diff --git a/src/main/java/com/google/gwtexpui/globalkey/client/NpTextArea.java b/src/main/java/com/google/gwtexpui/globalkey/client/NpTextArea.java index 0ee49c8..c06d2c4 100644 --- a/src/main/java/com/google/gwtexpui/globalkey/client/NpTextArea.java +++ b/src/main/java/com/google/gwtexpui/globalkey/client/NpTextArea.java
@@ -15,6 +15,7 @@ package com.google.gwtexpui.globalkey.client; import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.TextArea; public class NpTextArea extends TextArea { @@ -26,4 +27,8 @@ super(element); addKeyPressHandler(GlobalKey.STOP_PROPAGATION); } + + public void setSpellCheck(boolean spell) { + DOM.setElementPropertyBoolean(getElement(), "spellcheck", spell); + } }