Closed Bug 571352 Opened 14 years ago Closed 14 years ago

<select multiple> does not reset the anchor <option> properly when the anchor is removed

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b1

People

(Reporter: fryn, Assigned: MatsPalmgren_bugz)

References

Details

(Keywords: testcase)

Attachments

(2 files)

Attached file simple testcase
When selecting a range of <option> elements from a <select multiple> and then removing the anchor of that selection range, the anchor is moved to the previous <option> element, which often results in unexpected behavior.

*** This bug is probably not limited to just <select multiple> elements, but I have not had the time to investigate. If you would like to, please do! ***

Steps to reproduce:

1. Open up the simple testcase attached to this bug.
2. Click the <option> labelled 1.
3. Shift+click the <option> labelled 4. (Options 1-4 are now selected.)
4. Click the button labelled "Remove...". (Options 2-4 are now selected.)
5. Shift+click the <option> labelled 5.

Expected results:

Options 2-5 are now selected, because the anchor element should be been set to the closest <option> element inside the selection range (which is option 2 in this case).

Actual results:

Options 0,2-5 are now selected.

Notes:

While WebKit does not have this exact bug, it does has non-intuitive behavior of this writing. To demonstrate in Webkit: click option 5; then shift+click option 2; then remove option 5; then shift+click option 1. Now options 1 and 2 are selected. Why? WebKit resets the anchor to the first/top (rather than closest) element in the selection range.
Preserving the anchor..focus direction and range so that includes the same
options (except for the removed one), as before the removal seems reasonable.
Assignee: nobody → matspal
Keywords: testcase
Attached patch Patch rev. 1Splinter Review
Attachment #450852 - Flags: review?(bzbarsky)
Comment on attachment 450852 [details] [diff] [review]
Patch rev. 1

r=bzbarsky
Attachment #450852 - Flags: review?(bzbarsky) → review+
http://hg.mozilla.org/mozilla-central/rev/a84d22a38a6e
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a6
Depends on: 947690
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: