Skip to content

Commit 2fecec4

Browse files
authored
Bug 1931686 - don't preselect a component in the form to file a new bug
1 parent 125ce66 commit 2fecec4

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

extensions/BugModal/web/bug_modal.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,11 @@ $(function() {
625625

626626
// dirty field tracking
627627
$('#changeform select').each(function() {
628-
var that = $(this);
629-
var dirty = $('#' + that.attr('id') + '-dirty');
628+
const that = $(this);
629+
const id = that.attr('id');
630+
const dirty = $(`#${id}-dirty`);
631+
630632
if (!dirty) return;
631-
var isMultiple = that.attr('multiple');
632633

633634
// store the option that had the selected attribute when we
634635
// initially loaded
@@ -638,8 +639,8 @@ $(function() {
638639
that.data('preselected', value);
639640

640641
// if the user hasn't touched a field, override the browser's choice
641-
// with Bugzilla's
642-
if (!dirty.val())
642+
// with Bugzilla's, unless it's the component field
643+
if (id !== 'component' && !dirty.val())
643644
that.val(value);
644645
});
645646

extensions/BugModal/web/create.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ window.addEventListener('DOMContentLoaded', () => {
257257
if ($form.component.options.length === 1) {
258258
$form.component.selectedIndex = 0;
259259
} else {
260-
// Select first compponent if more than one and none are selected
261-
if ($form.component.selectedIndex === -1) {
262-
$form.component.selectedIndex = 0;
263-
}
264260
$form.component.addEventListener('change', () => {
265261
onComponentChange();
266262
});

0 commit comments

Comments
 (0)