Closed Bug 781514 Opened 8 years ago Closed 8 years ago

when loading a bug with IE all <select> fields are selecting the first item

Categories

(bugzilla.mozilla.org :: User Interface, defect)

Production
x86
All
defect
Not set
blocker

Tracking

()

RESOLVED FIXED

People

(Reporter: glob, Assigned: glob)

References

Details

Attachments

(2 files)

when loading a bug with IE8 all <select> fields are selecting the first item.

no doubt caused by bug 779434.
Attached patch patch v1 β€” β€” Splinter Review
Attachment #650549 - Flags: review?(dkl)
that isn't the best fix, due to the UA detection, but i'm having "fun" with IE8.
i'd like to get that reviewed and pushed asap.

i'll attach an updated patch to be pushed during our normal cycle which fixes this without the kludge (hopefully!).
Your patch will also affect IE9. Is IE9 also affected by this bug?
IE9 also fails
Comment on attachment 650549 [details] [diff] [review]
patch v1

Review of attachment 650549 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine with the fix on checkin. r=dkl

::: js/show_bug.js
@@ +31,5 @@
>          if (el_dirty) {
>              if (!el_dirty.value) {
> +                var preSelectedIndex = getPreSelectedIndex(el);
> +                if (preSelectedIndex != -1)
> +                    el.selectedIndex = preselectedIndex;

s/preselectedIndex/preSelectedIndex/
Attachment #650549 - Flags: review?(dkl) → review+
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.0/
modified js/show_bug.js
Committed revision 8273.
Summary: when loading a bug with IE8 all <select> fields are selecting the first item → when loading a bug with IE all <select> fields are selecting the first item
Attached patch patch v2 β€” β€” Splinter Review
here's the real fix, which applies on top of patch v1.
Attachment #650793 - Flags: review?(dkl)
Comment on attachment 650793 [details] [diff] [review]
patch v2

I am attempting at testing this on IE9 and I am getting different behavior from FF. On FF, if I simply change a select to a different value from the original bug value, and then refresh the page, my selected value stays the same. If I add console logging statements in various places, I see that under FF, the dirty field for the select is properly updated with a true value and nothing is done onload to the select.

Under IE, when I change a select and hit refresh, the selected option is reset back to the original bug value and will not retain my selected value. When viewing the console log, in onload, it does not see the dirty value as true and sets el.selectedIndex to preSelectedIndex each time. So should this be working the same way in both browsers?

dkl
(In reply to David Lawrence [:dkl] from comment #8)
> I am attempting at testing this on IE9 and I am getting different behavior
> from FF. [snip]

that's the correct behavour -- the goal is to not change the behavour of browsers to be consistent, rather to tweak firefox's behavour to bring it in line with user's expectations and avoid accidental changes.
Comment on attachment 650793 [details] [diff] [review]
patch v2

Review of attachment 650793 [details] [diff] [review]:
-----------------------------------------------------------------

then r=dkl
Attachment #650793 - Flags: review?(dkl) → review+
Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.0/
modified js/show_bug.js
Committed revision 8279.

Committing to: bzr+ssh://bjones%40mozilla.com@bzr.mozilla.org/bmo/4.2/
modified js/show_bug.js
Committed revision 8309.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.