diff options
author | Mika Murtojarvi <mika@vaadin.com> | 2015-02-16 17:33:15 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-03-03 08:22:56 +0000 |
commit | 0aa4af8f266a46a93ae7817c5e04dcef79389c94 (patch) | |
tree | cf4970be32a00b001c5c2456c7c92659225ede23 /client/src | |
parent | 05fc5806e7946223e057ad7458a18dadceb0566f (diff) | |
download | vaadin-framework-0aa4af8f266a46a93ae7817c5e04dcef79389c94.tar.gz vaadin-framework-0aa4af8f266a46a93ae7817c5e04dcef79389c94.zip |
Fix text input of PopupCalendar in Internet Explorer (#16677).
Similarly to VTextField, VTextualDate now uses KeyDownHandler with IE to
process the pressing of the return key.
Change-Id: I139134fc38678ad46f0c46f30e3de25547b9a3c6
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/com/vaadin/client/ui/VTextualDate.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VTextualDate.java b/client/src/com/vaadin/client/ui/VTextualDate.java index b95f696030..9055609e69 100644 --- a/client/src/com/vaadin/client/ui/VTextualDate.java +++ b/client/src/com/vaadin/client/ui/VTextualDate.java @@ -25,7 +25,11 @@ import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyDownEvent; +import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.user.client.ui.TextBox; +import com.vaadin.client.BrowserInfo; import com.vaadin.client.Focusable; import com.vaadin.client.LocaleNotLoadedException; import com.vaadin.client.LocaleService; @@ -39,7 +43,7 @@ import com.vaadin.shared.ui.datefield.Resolution; public class VTextualDate extends VDateField implements Field, ChangeHandler, Focusable, SubPartAware, HandlesAriaCaption, HandlesAriaInvalid, - HandlesAriaRequired { + HandlesAriaRequired, KeyDownHandler { private static final String PARSE_ERROR_CLASSNAME = "-parseerror"; @@ -107,7 +111,9 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, VTextualDate.this.fireEvent(event); } }); - + if (BrowserInfo.get().isIE()) { + addDomHandler(this, KeyDownEvent.getType()); + } add(text); } @@ -386,4 +392,14 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler, return null; } + + @Override + public void onKeyDown(KeyDownEvent event) { + if (BrowserInfo.get().isIE() + && event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + // IE does not send change events when pressing enter in a text + // input so we handle it using a key listener instead + onChange(null); + } + } } |