jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Jforrester: Looks good to me, but someone else must approve
Esanders: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I2df816ff80d6271eade60b6e9eb1aea870f098d5
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoĆski <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits