]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixing autocompletion issue with ComboBox on newer Chrome versions (#11524)
authorTatu Lund <tatu@vaadin.com>
Wed, 10 Apr 2019 11:42:58 +0000 (14:42 +0300)
committerSun Zhe <31067185+ZheSun88@users.noreply.github.com>
Wed, 10 Apr 2019 11:42:58 +0000 (14:42 +0300)
Newer Chrome versions do not work with random number hack to prevent auto completion, but it finally supports autocomplete=off.

Adapted from https://github.com/vaadin/framework/pull/11472

Fixes #11437

compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java

index 726efb5ec3f2d65848cbf79975b6facffd708c71..86fa8ed50040d91d43f1b33aab1a5562648dccf9 100644 (file)
@@ -1420,7 +1420,12 @@ public class VFilterSelect extends Composite
              * way, and they might be useful in a combo box where new items are
              * allowed.
              */
-            getElement().setAttribute("autocomplete", Math.random() + "");
+            if (BrowserInfo.get().isChrome()) {
+                // Chrome supports "off" and random number does not work with Chrome
+                getElement().setAttribute("autocomplete", "off");                      
+            } else {
+                getElement().setAttribute("autocomplete", Math.random() + "");
+            }
         }
 
         /**