Bartosz Dziewoński has uploaded a new change for review.
https://gerrit.wikimedia.org/r/243081
Change subject: TextInputWidget: Remove 'autocomplete' attribute on page
navigation
......................................................................
TextInputWidget: Remove 'autocomplete' attribute on page navigation
Turning off autocompletion also disables "form caching" when the user
navigates to a different page and then back. Re-enable it when
leaving, and re-disable when coming back.
Bug: T114134
Change-Id: I2df816ff80d6271eade60b6e9eb1aea870f098d5
---
M src/widgets/TextInputWidget.js
1 file changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/81/243081/1
diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index a902437..9dddc9e 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -140,6 +140,18 @@
}
if ( config.autocomplete === false ) {
this.$input.attr( 'autocomplete', 'off' );
+ // Turning off autocompletion also disables "form caching" when
the user navigates to a
+ // different page and then clicks "Back". Re-enable it when
leaving. Borrowed from jQuery UI.
+ $( window ).on( {
+ beforeunload: function () {
+ this.$input.removeAttr( 'autocomplete' );
+ }.bind( this ),
+ pageshow: function () {
+ // Browsers don't seem to actually fire this
event on "Back", they instead just reload the
+ // whole page... it shouldn't hurt, though.
+ this.$input.attr( 'autocomplete', 'off' );
+ }.bind( this )
+ } );
}
if ( this.multiline && config.rows ) {
this.$input.attr( 'rows', config.rows );
--
To view, visit https://gerrit.wikimedia.org/r/243081
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2df816ff80d6271eade60b6e9eb1aea870f098d5
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits