Closed Bug 277012 Opened 20 years ago Closed 16 years ago

RadioStateChange event doesn't fire for select-losing <radio>

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 320369

People

(Reporter: BenB, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(3 obsolete files)

The official ;-) reference doc
<http://www.xulplanet.com/references/elemref/ref_radiogroup.html#prop_selectedItem>
as well as the name implies that the RadioStateChange event should fire twice
during a change - once for the newly selected <radio> and once for the <radio>
which was previously selected. That would be needed anyways (because these
events fire after the change has been performed, you can check the state in the
handler via event.target.selected).

However, currently, only the newly selected radio gets the event. The radio
losing the select doesn't notice it.

Attaching a patch to fix it.
Attached patch Fix (obsolete) — Splinter Review
Attachment #170252 - Flags: review?(jag)
> The official ;-) reference doc
>
<http://www.xulplanet.com/references/elemref/ref_radiogroup.html#prop_selectedItem>
> as well as the name implies

Actually, re-reading the xulplanet sentence, it says the *opposite*, but the
name of the event implies to me that it should fire for both, plus there are
good use cases for it.
Comment on attachment 170252 [details] [diff] [review]
Fix

Nit: I think it would more intuitive to fire the state change event for the old
radio button first.
In fact, if you do that, you don't need to cache oldSelected. You can instead
just fire the event where you are currently setting that.
Attached patch Fix, v2 (obsolete) — Splinter Review
> Nit: I think it would more intuitive to fire the state change event
> for the old radio button first.

Agreed (and I think it's more than a nit, it matters for app developers)

> In fact, if you do that, you don't need to cache oldSelected. You can instead

> just fire the event where you are currently setting that.

I need to set it up, too. Easier (smaller change) this way IMHO.
Attachment #170252 - Attachment is obsolete: true
Attachment #170253 - Flags: review?(jag)
Attachment #170252 - Flags: review?(jag)
Attachment #170253 - Attachment description: Fix, v1 → Fix, v2
Attached patch Proposed Fix, v3 (obsolete) — Splinter Review
While working with it, I needed to remove that |if (focused)|, too, because
that prevented the event from firing when the selection got changed
programmatically in onload and co. It's something I could work around, but I
guess typical uses may want to see that.
Attachment #170267 - Flags: review?(jag)
Ben, are still working on this ?

***

</xpfe/global/resources/content/bindings/radio.xml>
is obsolete.
</toolkit/content/widgets/radio.xml>
is the one to fix now.

Is a v3 patch like was is wanted ?
Assignee: ben.bucksch → jag
Component: XP Apps → XP Toolkit/Widgets
OS: Linux → All
Product: Mozilla Application Suite → Core
QA Contact: pawyskoczka → xptoolkit.widgets
Hardware: PC → All
Version: 1.7 Branch → Trunk
Flags: wanted1.9.0.x?
Not wanted for 1.9.0.x. We've lived with this for a long time. Try requesting blocking/wanted1.9.1.
Flags: wanted1.9.0.x? → wanted1.9.0.x-
Flags: wanted1.9.1?
Comment on attachment 170267 [details] [diff] [review]
Proposed Fix, v3

This patch has been sitting around for years.  Neil, what do you think should happen here?

(Note that the XPFE version of this file no longer exists, but the patch looks like it applies (roughly, at least) to toolkit/content/widgets/radio.xml .)
Attachment #170267 - Flags: review?(enndeakin)
This has already been fixed by bug 320369.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
Attachment #170253 - Attachment is obsolete: true
Attachment #170253 - Flags: review?(jag)
Attachment #170267 - Attachment is obsolete: true
Attachment #170267 - Flags: review?(jag)
Attachment #170267 - Flags: review?(enndeakin)
Depends on: 456038
V.Duplicate

Yet, I filed bug 456038 as a followup...
Assignee: jag → nobody
Status: RESOLVED → VERIFIED
Component: XUL → Widget
Flags: wanted1.9.1?
QA Contact: xptoolkit.widgets → general
Flags: wanted1.9.1-
Flags: blocking1.9.1-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: