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

RESOLVED WORKSFORME

Status

()

Core
XUL
RESOLVED WORKSFORME
12 years ago
10 years ago

People

(Reporter: myk, Unassigned)

Tracking

1.8 Branch
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

339 bytes, application/vnd.mozilla.xul+xml
Details
(Reporter)

Description

12 years ago
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.
(Reporter)

Comment 1

12 years ago
Created attachment 226483 [details]
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.

Comment 2

10 years ago
Myk, WFM on SM trunk.
(Reporter)

Comment 3

10 years ago
Hmm, indeed this works now.  I guess it got fixed on the trunk.
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → WORKSFORME

Updated

10 years ago
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.