Skip to content

Commit cf55aa5

Browse files
committed
Bug 1170004: Pressing back after a bug submission error leaves the "Save Changes" button greyed out
1 parent ffd0e30 commit cf55aa5

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

extensions/BugModal/web/bug_modal.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ $(function() {
4848
}
4949
}
5050

51+
// restore edit mode after navigating back
52+
function restoreEditMode() {
53+
if (!$('#editing').val())
54+
return;
55+
$('.module')
56+
.each(function() {
57+
slide_module($(this), 'hide', true);
58+
});
59+
$($('#editing').val().split(' '))
60+
.each(function() {
61+
slide_module($('#' + this), 'show', true);
62+
});
63+
$('#mode-btn').click();
64+
$('.save-btn').prop('disabled', false);
65+
$('#editing').val('');
66+
}
67+
5168
// expand all modules
5269
$('#expand-all-btn')
5370
.click(function(event) {
@@ -996,18 +1013,8 @@ $(function() {
9961013
});
9971014

9981015
// finally switch to edit mode if we navigate back to a page that was editing
999-
if ($('#editing').val()) {
1000-
$('.module')
1001-
.each(function() {
1002-
slide_module($(this), 'hide', true);
1003-
});
1004-
$($('#editing').val().split(' '))
1005-
.each(function() {
1006-
slide_module($('#' + this), 'show', true);
1007-
});
1008-
$('#mode-btn').click();
1009-
$('#editing').val('');
1010-
}
1016+
$(window).on('pageshow', restoreEditMode);
1017+
restoreEditMode();
10111018
});
10121019

10131020
function confirmUnsafeURL(url) {

0 commit comments

Comments
 (0)