diff options
author | Tatu Lund <tatu@vaadin.com> | 2020-06-17 11:11:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 11:11:07 +0300 |
commit | 63434f9939968c9c7629b03b39016575dcf813c4 (patch) | |
tree | 9d9475179d59928192e28f65845aa8b8b57f7b0e /client/src | |
parent | e03a6fcda6647fe53b1353e50ba2e0910aa4744f (diff) | |
download | vaadin-framework-63434f9939968c9c7629b03b39016575dcf813c4.tar.gz vaadin-framework-63434f9939968c9c7629b03b39016575dcf813c4.zip |
Fixing issue with Vaadin 7 combobox when typing and tabing out fast (#12033)
ComboBox does not select or add a new value (in case allowed) if User enters the value by typing and TABs out fast. This bug was originally reported in https://github.com/vaadin/framework/issues/4276 and fixed by https://dev.vaadin.com/review/#/c/3564/6/client/src/com/vaadin/client/ui/VFilterSelect.java. However later some logic of VFilterSelect was refactored by patch https://github.com/vaadin/framework/commit/acb889336f80227d609b194e56ac6ae3ead0d338, which accidentally removed the fix. In this new PR I am re-applying the missing part of the logic (adopted to the new structure)
Fixes https://github.com/vaadin/framework/issues/6671
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VFilterSelect.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java index 148157cb84..f3856389b1 100644 --- a/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java +++ b/client/src/main/java/com/vaadin/client/ui/VFilterSelect.java @@ -1553,6 +1553,8 @@ public class VFilterSelect extends Composite /** For internal use only. May be removed or replaced in the future. */ public boolean updateSelectionWhenReponseIsReceived = false; + private boolean tabPressedWhenPopupOpen = false; + /** For internal use only. May be removed or replaced in the future. */ public boolean initDone = false; @@ -2200,6 +2202,8 @@ public class VFilterSelect extends Composite event.stopPropagation(); break; case KeyCodes.KEY_TAB: + tabPressedWhenPopupOpen = true; + waitingForFilteringResponse = false; case KeyCodes.KEY_ENTER: if (!allowNewItem) { @@ -2480,6 +2484,15 @@ public class VFilterSelect extends Composite focused = false; if (!readonly) { + if (tabPressedWhenPopupOpen) { + tabPressedWhenPopupOpen = false; + waitingForFilteringResponse = false; + } else if ((!suggestionPopup.isAttached() && waitingForFilteringResponse) + || suggestionPopup.isJustClosed()) { + // typing so fast the popup was never opened, or it's just + // closed + waitingForFilteringResponse = false; + } if (textInputEnabled && allowNewItem) { suggestionPopup.menu.doSelectedItemAction(); } |