Closed Bug 342273 Opened 18 years ago Closed 17 years ago

can't select menu item with non-breaking space in editable menulist

Categories

(Core :: XUL, defect)

1.8 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: myk, Unassigned)

Details

Attachments

(1 file)

339 bytes, application/vnd.mozilla.xul+xml
Details
In an editable menulist, the currently selected item is whichever item's label matches the value of the menulist.  And when you select an item in the menulist, the widget copies the label of the item to the value of the menulist element.

But if the item's label contains a non-breaking space, the widget converts that to a space in the process of copying it over.  And then, since the value and the label don't match, the menuitem doesn't get selected.  Instead, it's as if you selected the menuitem and then edited it (causing the item to get unselected in favor of your custom value).

The menuitem widget should either preserve non-breaking spaces or consider them equivalent to regular spaces for purposes of comparison between its value and the labels of its menuitems.
Attached file simple testcase
Here's a simple testcase that demonstrates the problem.  It contains an editable menulist with two items, the second of which contains a non-breaking space.  When you select an item, an oncommand listener pops up an alert showing you the value of the menulist's selectedIndex property.

If you select the first item, which doesn't contain a non-breaking space, then the alert displays 0, which is correct, since that item's index in the list is 0.  But if you select the second item, which does contain a non-breaking space, then the alert displays -1, which is incorrect, since that item's index in the list is 1.
Myk, WFM on SM trunk.
Hmm, indeed this works now.  I guess it got fixed on the trunk.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: xptoolkit.menus → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: