diff options
author | Tatu Lund <tatu@vaadin.com> | 2020-05-25 10:52:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-25 10:52:56 +0300 |
commit | 06947c6f90e3a4d9f85f399f383e21da4f6e12d4 (patch) | |
tree | 31fc13ef334141462b40fc48fc60f5fc1ac25062 /compatibility-client/src | |
parent | 4014f806a139b3bf00f9fc3e807817ac35ba9501 (diff) | |
download | vaadin-framework-06947c6f90e3a4d9f85f399f383e21da4f6e12d4.tar.gz vaadin-framework-06947c6f90e3a4d9f85f399f383e21da4f6e12d4.zip |
Moving disableBrowserAutocomplete to WidgetUtil and change widgets to use it (#12020)
* Add autocomplete prevention to DateField
Autocomplete popup will interfere DateField's own popup
* Adding disableBrowserAutocomplete(..) in WidgetUtil
* Change VComboBox to use WidgetUtil.disableBrowserAutocomplete(..)
* Change to use WidgetUtil.disableBrowserAutocomplete(..)
* Change VFilterSelect to use WidgetUtil.disableBrowserAutocomplete(..)
* Adding WidgetUtil.disableBrowserAutocomplete to VTextualDate
* Adding missing import
* Adding missing import
Diffstat (limited to 'compatibility-client/src')
-rw-r--r-- | compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java | 19 | ||||
-rw-r--r-- | compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java | 3 |
2 files changed, 5 insertions, 17 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java index 86fa8ed500..d7ae6f3c07 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java @@ -1409,23 +1409,8 @@ public class VFilterSelect extends Composite * @since 7.6.4 */ public FilterSelectTextBox() { - /*- - * Stop the browser from showing its own suggestion popup. - * - * Using an invalid value instead of "off" as suggested by - * https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion - * - * Leaving the non-standard Safari options autocapitalize and - * autocorrect untouched since those do not interfere in the same - * way, and they might be useful in a combo box where new items are - * allowed. - */ - 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() + ""); - } + // Stop the browser from showing its own suggestion popup. + WidgetUtil.disableBrowserAutocomplete(this); } /** diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java index 4d52e3e4f8..e332e628fd 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTextualDate.java @@ -35,6 +35,7 @@ import com.vaadin.client.BrowserInfo; import com.vaadin.client.Focusable; import com.vaadin.client.LocaleNotLoadedException; import com.vaadin.client.LocaleService; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.ui.SubPartAware; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.client.ui.aria.HandlesAriaCaption; @@ -115,6 +116,8 @@ public class VTextualDate extends VDateField if (BrowserInfo.get().isIE()) { addDomHandler(this, KeyDownEvent.getType()); } + // Stop the browser from showing its own suggestion popup. + WidgetUtil.disableBrowserAutocomplete(text); add(text); } |