Closed Bug 365773 Opened 19 years ago Closed 19 years ago

radiogroup.selectedItem = null fails if group is focused

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jwkbugzilla, Assigned: jwkbugzilla)

Details

Attachments

(2 files, 2 obsolete files)

The radiogroup XUL tag implementation contains the following code in the selectedItem setter: if (!alreadySelected && focused) { // Only report if actual change var myEvent = document.createEvent("Events"); myEvent.initEvent("RadioStateChange", true, true); val.dispatchEvent(myEvent); Problem: that val might be null and this case is not checked - the setter will throw an exception. Condition is that current document focus is on this radio group, otherwise focused will be false.
Attached file mochitest compatible testcase (obsolete) —
Assignee: nobody → trev
Status: NEW → ASSIGNED
Sorry, attached wrong file - now the correct testcase.
Attachment #250334 - Attachment is obsolete: true
Attached patch Add missing check (obsolete) — Splinter Review
Trivial fix, selectedItem setter no longer throws an exception. Neil, can you review this? You reviewed the previous patch in this area.
Attachment #250336 - Flags: first-review?(neil)
Comment on attachment 250336 [details] [diff] [review] Add missing check Nit: scoping of myEvent "looks" incorrect. Please move it before if (val) Note: Setting selectedItem to null seems to kill the focus and break keyboard navigation because focusedItem should not be null while the radiogroup has focus. (Aside: Why don't we have a focusedIndex property?)
Attachment #250336 - Flags: first-review?(neil) → first-review+
Does it need a second review to be checked in?
Attachment #250336 - Attachment is obsolete: true
Attachment #250344 - Flags: first-review+
Whiteboard: [checkin needed]
mozilla/toolkit/content/widgets/radio.xml 1.24 mozilla/xpfe/global/resources/content/bindings/radio.xml 1.45
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: [checkin needed]
Attachment #250335 - Flags: first-review?(neil)
Comment on attachment 250335 [details] mochitest compatible testcase Sorry, I don't know the test harness.
Attachment #250335 - Flags: first-review?(neil)
Comment on attachment 250335 [details] mochitest compatible testcase Robert, can you review this testcase?
Attachment #250335 - Flags: first-review?(sayrer)
Attachment #250335 - Flags: first-review?(sayrer) → first-review+
mozilla/testing/mochitest/tests/test_bug365773.xul 1.1
Flags: in-testsuite+
Version: unspecified → Trunk
Gavin, mozilla/testing/mochitest/tests/index.html needs to be updated as well when checking in testcases.
Ah, right, thanks for catching my mistake. I see Rob already fixed it.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: