Closed Bug 251833 Opened 20 years ago Closed 20 years ago

onChange refired when pull-down menu loses focus

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: bulbul, Assigned: neil)

Details

(Keywords: regression)

Attachments

(4 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040714
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040714

In the web mail interface, i can selected all messages on a page via a pull-down
menu. Each message has a checkbox by it, and when i do "select" all, all of
these boxes become checked. However, if i either try to uncheck any box on the
list or click on the "mark as" pull-down menu, all of the boxes become unchecked.

This is not a problem in the Javascript, because in the case of the "mark as"
pull-down menu, i can click on it without triggering "onchange" and this
behavior is still displayed. I checked this by placing an alert box in the
function called upon "onchange", to make sure that there wasn't some Javascript
function doing the reset.

This problem occurs only if the boxes are checked using the pull-down menu. If i
check all of the checkboxes manually, no problem occurs.

I will upload a whittled down page from this interface.

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040714

This is something that i think worked in Mozilla 1.7.

Here are the instructions to follow on the file i will upload:

1. Using the "select" pull-down menu, select "all". All checkboxes
   will be selected.
2. Now click on the "mark" pull-down menu, without even changing 
   its value. OR Try unchecking one of the message checkboxes.
3. Observe that the checkboxes have all become unchecked.


Reproducible: Always
Steps to Reproduce:
Attaching reduced page which displays the problem, as promised.
I have now tested this in Mozilla 1.5, 1.6, and 1.7, and the checkboxes behave
correctly in all of those. So, the bug was introduced some time after 1.7.
Similarly, the problem is absent in Firefox 0.9.1, but is present in the latest
nightly.
I think i've been able to pinpoint where this bug first appeared. The bug is
absent in build: 
   Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040525
But it is present in build:
   Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040601
Attaching a reduced test case.
It seems onChange fires again when the "select:" pull-down menu loses focus.
Because "document.select1.reset();" resets the value/flag to "" during the first
onChange the checkboxes become unchecked by the second onChange. 
Looking at checkins between 20040525 and 20040601, bug 244761 comment 13 could
be related.
Your characterization in comment #6 is correct. I now see that after selecting
the checkboxes with the pull-down menu, all i need to do to uncheck all of the
boxes is to click anywhere on the page, thus causing the pull-down to loose
focus. Changing the summary line accordingly.

Summary was:
   checkboxes selected with Javascript are unselected on
   interaction with form element
Is now:
   onChange refired when pull-down menu loses focus
Summary: checkboxes selected with Javascript are unselected on interaction with form element → onChange refired when pull-down menu loses focus
Well, maybe i was too hasty there. Yes, comment #6 is correct in that the
problem occurs when the pull-down menu loses focus. However, if an onChange is
triggered, it isn't the onChange for that menu. If you put an alert dialog in
the Javascript function called for the onchange property of the pull-down, it
does not reappear when the menu loses focus.
Assignee: nobody → neil.parkwaycc.co.uk
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
OS: Linux → All
Hardware: PC → All
Attached patch Proposed patchSplinter Review
Comment on attachment 153609 [details] [diff] [review]
Proposed patch

So, my new idea is for the listbox to notify the combobox whenever the user is
about to change the selection so that FireOnChange can compare the selected
index to the one from just before the user started changing it.
Attachment #153609 - Flags: superreview?(roc)
Attachment #153609 - Flags: review?(roc)
Comment on attachment 153609 [details] [diff] [review]
Proposed patch

OK but please retest on the previous bug that caused this regression
Attachment #153609 - Flags: superreview?(roc)
Attachment #153609 - Flags: superreview+
Attachment #153609 - Flags: review?(roc)
Attachment #153609 - Flags: review+
Attached file Simple test
Neil. Could you please clarify what your test case is for: this bug or
regression testing for bug 244761? Your test case does not test this bug
although it can be used to test bug 244761. Please read comment #8 if you
intended it for this bug. 

(Sorry i don't know how to apply your patch to Mozilla for testing, which would
have obviated the need for this question. Thank you for addressing this bug so
quickly.)
Correct, it's to help me regression test bug 244761.
I have recompiled the latest trunk with the patch, and my test case now works
fine, as does the test case for bug 244761. Since this has been superreviewed,
will it get checked in soon?

For some reason, i couldn't get your patch to compile, so i applied all of the
changes manually.

Thanks for fixing this so quickly. This bug showed up using the UCLA student
e-mail web interface. UCLA actually recommends Mozilla, and this should help us
maintain that recommendation.
Checking in as I feel this has been sufficiently well tested now.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: