File tree 5 files changed +31
-35
lines changed
client/src/main/java/com/vaadin/client
compatibility-client/src/main/java/com/vaadin/v7/client/ui
5 files changed +31
-35
lines changed Original file line number Diff line number Diff line change 42
42
import com .google .gwt .user .client .EventListener ;
43
43
import com .google .gwt .user .client .Window ;
44
44
import com .google .gwt .user .client .ui .RootPanel ;
45
+ import com .google .gwt .user .client .ui .TextBox ;
45
46
import com .google .gwt .user .client .ui .Widget ;
46
47
import com .vaadin .shared .ui .ErrorLevel ;
47
48
import com .vaadin .shared .util .SharedUtil ;
@@ -1962,4 +1963,25 @@ public static Element createErrorIndicatorElement() {
1962
1963
return indicator ;
1963
1964
}
1964
1965
}
1966
+
1967
+ public static void disableBrowserAutocomplete (TextBox textBox ) {
1968
+ /*-
1969
+ * Stop the browser from showing its own suggestion popup.
1970
+ *
1971
+ * Using an invalid value instead of "off" as suggested by
1972
+ * https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
1973
+ *
1974
+ * Leaving the non-standard Safari options autocapitalize and
1975
+ * autocorrect untouched since those do not interfere in the same
1976
+ * way, and they might be useful in a combo box where new items are
1977
+ * allowed.
1978
+ */
1979
+ if (BrowserInfo .get ().isChrome ()) {
1980
+ // Chrome supports "off" and random number does not work with
1981
+ // Chrome
1982
+ textBox .getElement ().setAttribute ("autocomplete" , "off" );
1983
+ } else {
1984
+ textBox .getElement ().setAttribute ("autocomplete" , Math .random () + "" );
1985
+ }
1986
+ }
1965
1987
}
Original file line number Diff line number Diff line change 36
36
import com .vaadin .client .Focusable ;
37
37
import com .vaadin .client .LocaleNotLoadedException ;
38
38
import com .vaadin .client .LocaleService ;
39
+ import com .vaadin .client .WidgetUtil ;
39
40
import com .vaadin .client .ui .aria .AriaHelper ;
40
41
import com .vaadin .client .ui .aria .HandlesAriaCaption ;
41
42
import com .vaadin .client .ui .aria .HandlesAriaInvalid ;
@@ -90,6 +91,8 @@ public VAbstractTextualDate(R resoluton) {
90
91
if (BrowserInfo .get ().isIE ()) {
91
92
addDomHandler (this , KeyDownEvent .getType ());
92
93
}
94
+ // Stop the browser from showing its own suggestion popup.
95
+ WidgetUtil .disableBrowserAutocomplete (text );
93
96
add (text );
94
97
publishJSHelpers (getElement ());
95
98
}
Original file line number Diff line number Diff line change @@ -1438,24 +1438,7 @@ public class FilterSelectTextBox extends TextBox {
1438
1438
* @since 7.6.4
1439
1439
*/
1440
1440
public FilterSelectTextBox () {
1441
- /*-
1442
- * Stop the browser from showing its own suggestion popup.
1443
- *
1444
- * Using an invalid value instead of "off" as suggested by
1445
- * https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
1446
- *
1447
- * Leaving the non-standard Safari options autocapitalize and
1448
- * autocorrect untouched since those do not interfere in the same
1449
- * way, and they might be useful in a combo box where new items are
1450
- * allowed.
1451
- */
1452
- if (BrowserInfo .get ().isChrome ()) {
1453
- // Chrome supports "off" and random number does not work with
1454
- // Chrome
1455
- getElement ().setAttribute ("autocomplete" , "off" );
1456
- } else {
1457
- getElement ().setAttribute ("autocomplete" , Math .random () + "" );
1458
- }
1441
+ WidgetUtil .disableBrowserAutocomplete (this );
1459
1442
}
1460
1443
1461
1444
/**
Original file line number Diff line number Diff line change @@ -1409,23 +1409,8 @@ public class FilterSelectTextBox extends TextBox {
1409
1409
* @since 7.6.4
1410
1410
*/
1411
1411
public FilterSelectTextBox () {
1412
- /*-
1413
- * Stop the browser from showing its own suggestion popup.
1414
- *
1415
- * Using an invalid value instead of "off" as suggested by
1416
- * https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
1417
- *
1418
- * Leaving the non-standard Safari options autocapitalize and
1419
- * autocorrect untouched since those do not interfere in the same
1420
- * way, and they might be useful in a combo box where new items are
1421
- * allowed.
1422
- */
1423
- if (BrowserInfo .get ().isChrome ()) {
1424
- // Chrome supports "off" and random number does not work with Chrome
1425
- getElement ().setAttribute ("autocomplete" , "off" );
1426
- } else {
1427
- getElement ().setAttribute ("autocomplete" , Math .random () + "" );
1428
- }
1412
+ // Stop the browser from showing its own suggestion popup.
1413
+ WidgetUtil .disableBrowserAutocomplete (this );
1429
1414
}
1430
1415
1431
1416
/**
Original file line number Diff line number Diff line change 35
35
import com .vaadin .client .Focusable ;
36
36
import com .vaadin .client .LocaleNotLoadedException ;
37
37
import com .vaadin .client .LocaleService ;
38
+ import com .vaadin .client .WidgetUtil ;
38
39
import com .vaadin .client .ui .SubPartAware ;
39
40
import com .vaadin .client .ui .aria .AriaHelper ;
40
41
import com .vaadin .client .ui .aria .HandlesAriaCaption ;
@@ -115,6 +116,8 @@ public void onBlur(BlurEvent event) {
115
116
if (BrowserInfo .get ().isIE ()) {
116
117
addDomHandler (this , KeyDownEvent .getType ());
117
118
}
119
+ // Stop the browser from showing its own suggestion popup.
120
+ WidgetUtil .disableBrowserAutocomplete (text );
118
121
add (text );
119
122
}
120
123
You can’t perform that action at this time.
0 commit comments