]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1210078: Going back from the "Match failed" page deletes the values of user fields
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 19 Oct 2015 16:16:28 +0000 (18:16 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 19 Oct 2015 16:16:28 +0000 (18:16 +0200)
r=gerv

js/field.js
js/global.js

index 2bd8868f82a81f8cc0a3d4fd7b4fc5c0e37283cb..063d48c476796bcc35ac1273e3ed6bf9013aa627 100644 (file)
@@ -794,6 +794,7 @@ $(function() {
             else {
                 that.devbridgeAutocomplete(options_user);
             }
+            that.addClass('bz_autocomplete');
         });
 
     // init autocomplete fields with array of values
@@ -809,6 +810,7 @@ $(function() {
                     this.focus();
                 }
             });
+            that.addClass('bz_autocomplete');
         });
 });
 
index b4905e202b763f73c51943f43b18d435f48feee7..dcffc35290935e3ff2f7530eccc555c13e4ee964 100644 (file)
@@ -51,3 +51,15 @@ function display_value(field, value) {
     if (translated) return translated;
     return value;
 }
+
+// jQuery auto-completion disables browser native autocompletion, however this
+// excludes it from being restored by bfcache. Trick the browser into restoring
+// it by changing the autocomplete attribute when a page is hidden and shown.
+$().ready(function() {
+  $(window).on('pagehide', function() {
+    $('.bz_autocomplete').attr('autocomplete', 'on');
+  });
+  $(window).on('pageshow', function() {
+    $('.bz_autocomplete').attr('autocomplete', 'off');
+  });
+});