Closed Bug 685464 Opened 13 years ago Closed 13 years ago

DOMMenuItemActive is not consistent for menulist items

Categories

(Core :: XUL, defect)

All
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: surkov, Assigned: neil)

References

(Blocks 1 open bug)

Details

(Keywords: access)

Attachments

(1 file, 2 obsolete files)

steps to reproduce:

1) tab to menulist
2) down arrow to select second menuitem
3) alt+down arrow to show menupopup
result: DOMMenuItemActive event is not fired for second item

4) escape menupopup
5) alt+down arrow to show menupopup
result: DOMMenuItemActive event is fired for second item

DOMMenuItemActive event should be fired in both cases (that makes it closer to HTML selects).

On menulist binding keypress activeChild is changed (as result of processing by menuBoxObject). On the another hand menulist binding has popupshowing event handler where it sets menuBoxObject.activeChild what causes events if active child is changed. So since activeChild is not changed then no events.

This bug is important for focus handling in accessibility.
Attached patch Possible patch (obsolete) — Splinter Review
Does this help?
Attachment #559074 - Flags: feedback?(surkov.alexander)
Attached patch Alternate approach (obsolete) — Splinter Review
This version avoids clearing the active child when we don't need to. (Clearing the active child when it is already clear doesn't do anything significant.)
Attachment #559075 - Flags: feedback?(surkov.alexander)
Comment on attachment 559074 [details] [diff] [review]
Possible patch

yes, thank you, Neil! This may cause extra DOMMenuItemInactive event but accessibility doesn't depend on it and if it is then I don't know whether this good or bad.
Attachment #559074 - Flags: feedback?(surkov.alexander) → feedback+
Comment on attachment 559075 [details] [diff] [review]
Alternate approach

this works too (both menulist and editable menulist)
Attachment #559075 - Flags: feedback?(surkov.alexander) → feedback+
(In reply to alexander surkov from comment #3)
> Comment on attachment 559074 [details] [diff] [review]
> Possible patch
> 
> yes, thank you, Neil! This may cause extra DOMMenuItemInactive event but
> accessibility doesn't depend on it and if it is then I don't know whether
> this good or bad.

to avoid potential confusion: "and if it is" means "if there's extra DOMMenuItemInactive".
Comment on attachment 559075 [details] [diff] [review]
Alternate approach

I guess it's down to Enn as to which one he likes best.
Attachment #559075 - Flags: review?(enndeakin)
Assignee: nobody → neil
Status: NEW → ASSIGNED
Comment on attachment 559075 [details] [diff] [review]
Alternate approach

>diff --git a/toolkit/content/widgets/menulist.xml b/toolkit/content/widgets/menulist.xml
>--- a/toolkit/content/widgets/menulist.xml
>+++ b/toolkit/content/widgets/menulist.xml
>@@ -28,10 +28,11 @@
>       <handler event="command" phase="capturing"
>         action="if (event.target.parentNode.parentNode == this) this.selectedItem = event.target;"/>
> 
>       <handler event="popupshowing">
>         <![CDATA[
>+          this.menuBoxObject.activeChild = null;
>           if (event.target.parentNode == this && this.selectedItem)

Don't you want to put this inside the 'event.target.parentNode == this' check, as you've done with the editable menulist?
Attachment #559075 - Flags: review?(enndeakin) → review+
(In reply to Neil Deakin from comment #7)
> Don't you want to put this inside the 'event.target.parentNode == this'
> check, as you've done with the editable menulist?
Indeed. I'll update the patch.
Attachment #559074 - Attachment is obsolete: true
Attachment #559075 - Attachment is obsolete: true
Attachment #559536 - Flags: review?(enndeakin)
Attachment #559536 - Flags: feedback?(surkov.alexander)
Attachment #559536 - Flags: review?(enndeakin) → review+
Comment on attachment 559536 [details] [diff] [review]
Updated for review comments

f=me, thank you!
Attachment #559536 - Flags: feedback?(surkov.alexander) → feedback+
http://hg.mozilla.org/mozilla-central/rev/01256254361b
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla9
Summary: DOMMenuItemActive is not consistent menulist items → DOMMenuItemActive is not consistent for menulist items
Component: XP Toolkit/Widgets: Menus → XUL
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: