Closed Bug 127118 Opened 24 years ago Closed 21 years ago

Pressing access key for radio button doesn't focus radio group or show focus on radio button

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P1)

x86
Windows 2000
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: deanis74, Assigned: aaronlev)

Details

Attachments

(1 file, 2 obsolete files)

Steps: 1. Open the test case from bug 989 (attachment 59811 [details]) 2. Press Alt+B 3. Watch radio1 select and get the focus indicator around it 4. Press Alt+C Expected Results: radio2 is selected and gets the focus indicator Actual Results: radio2 is selected but no focus indicator. If I press Alt+C again, the focus indicator is drawn.
QA Contact: madhur → rakeshmishra
QA Contact: rakeshmishra → trix
I've just noticed that radio buttons never get focussed since at least 1.4 (although to be precise it's the radio group that should get focussed).
Assignee: jag → aaronleventhal
Attachment #150347 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 150347 [details] [diff] [review] For mouse down or focus event on a radio button, we need focus the radio group, then select the button > <handler event="mousedown" button="0"> > <![CDATA[ >- if (!this.disabled) >+ if (!this.disabled) { >+ this.radioGroup.focus(); > this.radioGroup.focusedItem = this; >+ } >+ ]]> >+ </handler> I don't see why you need this change; clicking a radio button with the mouse already focuses the group. >+ <handler event="focus"> >+ <![CDATA[ >+ if (!this.disabled) { >+ this.radioGroup.focus(); >+ this.radioGroup.focusedItem = this; >+ } > ]]> > </handler> > </handlers> I'm not sure why you need to set the focused item but if you do you should set it before focussing the group.
Attachment #150347 - Flags: review?(neil.parkwaycc.co.uk) → review-
Why do we make it possible to have a different focusedItem and selectedItem? We should ensure that they're the always same. That's just how radio buttons work -- you focus a radio button and it gets selected. Likewise, you select a radio button and if the group has focus, the radio button also gets focus. It stays in sync. (In reply to comment #3) > (From update of attachment 150347 [details] [diff] [review]) > > <handler event="mousedown" button="0"> > > <![CDATA[ > >- if (!this.disabled) > >+ if (!this.disabled) { > >+ this.radioGroup.focus(); > > this.radioGroup.focusedItem = this; > >+ } > >+ ]]> > >+ </handler> > I don't see why you need this change; clicking a radio button with the mouse > already focuses the group. > > >+ <handler event="focus"> > >+ <![CDATA[ > >+ if (!this.disabled) { > >+ this.radioGroup.focus(); > >+ this.radioGroup.focusedItem = this; > >+ } > > ]]> > > </handler> > > </handlers> > I'm not sure why you need to set the focused item but if you do you should set > it before focussing the group. >
(In reply to comment #4) >Why do we make it possible to have a different focusedItem and selectedItem? Because focus and selection happen on different events, for example, Checkbox: mousedown becomes focused; mouseup becomes toggled. Radio: mousedown becomes focused; mouseup becomes selected.
Actually in my mind focusedIndex and selectedIndex should be merged into one variable. Right now the esm code does this when an accesskey is fired on a xul:radio - element->Focus(); element->Click(); In reality doing one or the other should also work. So, perhaps this patch should be changed to either 1) set both selectedIndex and focusedIndex, and then focus the group or 2) merge them into 1 variable.
Attachment #150347 - Attachment is obsolete: true
Attachment #150353 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #150353 - Flags: review?(neil.parkwaycc.co.uk)
Attachment #150353 - Attachment is obsolete: true
Attachment #150359 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 150359 [details] [diff] [review] New patch setting focusedItem not selectedItem Hmm... this file is nicely inconsistent as to whether to leave blank lines between handlers...
Attachment #150359 - Flags: review?(neil.parkwaycc.co.uk) → review+
Summary: Pressing access key for radio group doesn't focus if radio group has focus → Pressing access key for radio button doesn't focus radio group or show focus on radio button
Attachment #150359 - Flags: superreview?(bryner)
Priority: -- → P1
Comment on attachment 150359 [details] [diff] [review] New patch setting focusedItem not selectedItem sr=bryner
Attachment #150359 - Flags: superreview?(bryner) → superreview+
Checking in xpfe/global/resources/content/bindings/radio.xml; /cvsroot/mozilla/xpfe/global/resources/content/bindings/radio.xml,v <-- radio.xml new revision: 1.33; previous revision: 1.32 done Checking in toolkit/content/widgets/radio.xml; /cvsroot/mozilla/toolkit/content/widgets/radio.xml,v <-- radio.xml new revision: 1.7; previous revision: 1.6 done
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Patch re-checked in Checking in widgets/radio.xml; /cvsroot/mozilla/toolkit/content/widgets/radio.xml,v <-- radio.xml new revision: 1.13; previous revision: 1.12 done Checking in nsWidgetStateManager.js; /cvsroot/mozilla/toolkit/content/nsWidgetStateManager.js,v <-- nsWidgetStateManager.js new revision: 1.10; previous revision: 1.9 done
Keywords: aviary-landing
Keywords: aviary-landing
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: