Closed Bug 267627 Opened 21 years ago Closed 21 years ago

select event isn't fired when selection of listbox is changed

Categories

(Core :: XUL, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: surkov, Assigned: csthomas)

References

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 I have listbox with seltype='multiple'. I select some items. Select event isn't fired when I click on some selected item. In other words when I reduce selection of listbox by clicking on selected item then event isn't fired. I guess there is problem in click event handler of listitem binding. var didSuppressSelect = false; var i = 0; while (i < selectedItems.length) { if (selectedItems[i] != this) { if (!didSuppressSelect) { parentNode._suppressOnSelect = true; didSuppressSelect = true; } parentNode.removeItemFromSelection(selectedItems[i]); } else i++; } When _suppressOnSelect=true then select event isn't fired. Need to switch _suppressOnSelect and fire event after all calls of methods removeItemFromSelection(). Reproducible: Always Steps to Reproduce:
> Select event isn't fired when I click on some selected item. Select event applies only for input type text and password and when selecting/highlighting text. http://www.w3.org/TR/html4/interact/scripts.html#adef-onselect > In other words when I reduce selection > of listbox by clicking on selected item then event isn't fired. > > I guess there is problem in click event handler of listitem binding. Click and change events are also different events. http://www.w3.org/TR/html4/interact/scripts.html#adef-onchange Can you attach a *reduced* testcase showing the problem? What is a Simplified Test Case, and How Do I Make One? http://www.mozilla.org/newlayout/bugathon.html#testcase
>Select event applies only for input type text and password and when >selecting/highlighting text. I know what DOM Events Level2 specification says about select event. But I seem XUL has extended event model. See xulplanet http://www.xulplanet.com/references/elemref/ref_EventHandlers.html#attr_onselect. See realization of listitem binding (it fires select event!): chrome://global/content/bindings/listbox.xml#listitem. >Click and change events are also different events I didn't told about change event I told about select event. Also I told that listitem binding fires select event on click event.
Attached file testcase
We can follow DOM Level2 Events specification and can remove firing of select event from listbox element. In this case developers cannot know about selection changes immediately (they will have chnage event only). But we can serve extention of w3c specification for xul elements and we can add one line in click hangler of listitem element. if (didSuppressSelect) parentNode._suppressOnSelect = false; parentNode._fireOnSelect();//we can add this line only to fire select event
Need to write: if (didSuppressSelect){ parentNode._suppressOnSelect = false; parentNode._fireOnSelect(); }
Keywords: helpwanted
Assignee: nobody → cst
Keywords: helpwanted
Whiteboard: active
Attached patch patchSplinter Review
See comment #5. This makes the testcase work as the reporter expects.
Attachment #166293 - Flags: superreview?(roc)
Attachment #166293 - Flags: review?(dbaron)
Comment on attachment 166293 [details] [diff] [review] patch Brian might have more of a clue about this than either dbaron or I.
Attachment #166293 - Flags: superreview?(roc)
Attachment #166293 - Flags: superreview?(bryner)
Attachment #166293 - Flags: review?(dbaron)
Attachment #166293 - Flags: review?(bryner)
Whiteboard: active → active, r?
Attachment #166293 - Flags: superreview?(bryner)
Attachment #166293 - Flags: superreview+
Attachment #166293 - Flags: review?(bryner)
Attachment #166293 - Flags: review+
checked in by timeless
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
QA Contact: stephend
Resolution: --- → FIXED
Whiteboard: active, r?
https://bugzilla.mozilla.org/attachment.cgi?id=164689&action=view is working fine for me now with build 2004-12-07-06 on Windows XP. Tried all types of selection, including contiguous and non-contiguous. Verified FIXED
Status: RESOLVED → VERIFIED
*** Bug 279096 has been marked as a duplicate of this bug. ***
*** Bug 135172 has been marked as a duplicate of this bug. ***
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: stephen.donner → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: