Closed Bug 294256 Opened 20 years ago Closed 18 years ago

editable menulist can't display initial value which is not in the menupopup

Categories

(Core :: XUL, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: pwilson, Unassigned)

Details

(Keywords: helpwanted)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050510 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b2) Gecko/20050510 Firefox/1.0+

A <menulist editable="true" disableautoselect="true" label="X"> fails to display
an initial label value which is not in the dropdown list. 



Reproducible: Always

Actual Results:  
The menulist input field is empty. 


The culprit seems to be in XBL file menulist.xml, property: selectedItem, 
lines 371-376

            if (!this.selectedInternal) {
              this.inputField.value = "";
              this.removeAttribute('value');
              this.removeAttribute('label');
              return val;
            }
This can not be correct. If no item is selected then the inputField value must 
remain unchanged, and should reflect the value set via the label/value
attributes, or entered by the user. 
There may be other resons for this code, but I have created a version with these
lines commented out and everything seems to work for my particular usage.
That's not a bug in XBL, just in a _user_ of XBL...  This component is for bugs
about XBL itself not working right (as in, you write a binding, and it doesnt'
work as it should).
Assignee: general → jag
Status: UNCONFIRMED → NEW
Component: XBL → XP Toolkit/Widgets
Ever confirmed: true
QA Contact: ian → jrgmorrison
Summary: editable menulist ca't display initial value which is not in the menupopup → editable menulist can't display initial value which is not in the menupopup
Assignee: jag → nobody
Component: XP Toolkit/Widgets → XP Toolkit/Widgets: Menus
QA Contact: jrgmorrison
Hmm... it looks to me as if we shouldn't be trying to set the initial selection
in an editable menulist. Instead, we should rely on the (optional) autoselect.
Keywords: helpwanted
This was fixed by bug 333023
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
(In reply to comment #3)
>This was fixed by bug 333023

In particular, this part of the diff, from setInitialSelection:

>-              else
>+              else if (!editable)
>                 this.selectedIndex = 0;
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.