Closed Bug 279108 Opened 20 years ago Closed 19 years ago

in a listbox onselect is called after a call to clearselection()

Categories

(Core :: XUL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED EXPIRED

People

(Reporter: marja, Unassigned)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20050105 

listbox onselect is called even when nothing is selected

for example:
when I clear the selection in the onselect callback function with 
clearSelection() the callback function handletopicItemSelection() gets called

case:

<listbox id = "topicresultList"
   flex = "1"
    datasources = "rdf:null"
    ref = "urn:myroot"
    observes = "bc_displayResults"
    onselect = "handletopicItemSelection();event.preventBubble();">
    ...
</listbox>

function handletopicItemSelection() {
/**
 *  Shows the selected topic.
 */

   var
      listbox = document.getElementById("topicresultList"),
      item = listbox.selectedItem;

   dump("  item: "+item+"\n");

   /* return if nothing is selected from listbox -
       not sure why this is even called in that case ...  */
    if (item == null) {
      dump("  why is this called????\n");
      return;
    }

    var
      uri = item.getAttribute("resourceuri");

    if (uri) {
      listbox.clearSelection();
      dump("  after clear selection calls this function 
again\n");
      showTopic(uri);
      dump("  after show topic\n");
      return;
    }
}

Reproducible: Always

Steps to Reproduce:
1. select listbox item (opens topic window)
2. close topic window 
3. select same listbox item again (open the closed topic window again)

Actual Results:  
after selecting the listbox item on step 1 and step 3 the onselect function is 
called twice after each step, not once

Expected Results:  
only call the onselect function when an item is selected from the listbox

I also wanted to be able to select the same item again even if it was already 
select (selection opens a windows and if it is closed the user may want to 
open the same window again). So either I need to get the selection even if the 
same item was already selected on clear the selection myself as I'm doing now.
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
Firefox:     http://www.mozilla.org/projects/firefox/
Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html
Seamonkey:   http://www.mozilla.org/projects/seamonkey/
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → EXPIRED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.