Closed Bug 390698 Opened 15 years ago Closed 13 years ago

Extra MENUPOPUPEND event when using Dojo context menu


(Core :: Disability Access APIs, defect)

Not set





(Reporter: aaronlev, Assigned: davidb)


(Blocks 1 open bug)


(Keywords: access)


(1 file)

1. Load
2. In textfield type Shift+F10
3. MENUPOPUPEND event is mysteriously fired before MENUPOPUPSTART
Blocks: aria
Two problems:
First, I'd prefer that the node with the menu role be what's shown or hidden, but we might be able to deal with that.
Worse, Dojo is quickly showing, then hiding, then showing the div again.
Actually, here's roughly what's happening, but I need a better way to debug this:

1. <div> appended
2. <table> removed
3. <table> appended (same one from step 2)
4. div styled to invisible
5. A whole bunch of stuff inside the <table> gets styled to be invisible
6. A div gets styled to visible
7. A whole bunch of stuff inside the <table> gets styled to visible
8. A couple of divs get styled to visible

Something like that. I guess it's real world usage, but it's confusing why the table is removed then inserted like that.
Note for me -- also for some reason the events are coming out as event-from-user-input: false
Here's the correct series of events:
1. append <div> node 
2. remove <table> node 
3. re-append <table> node 
4. hide cells, text nodes, other sub-content of table
5. hide <table>, 6 times  (makes no sense that we were notified more than once)
6. hide <div>
7. re-show cells, text nodes, other sub-content of table
8. re-show <table>, 6 times  (makes no sense that we were notified more than once)
9. re-show <div>

Simon, does that make sense to you?

I suspect Dojo is doing more thrashing here that it needs to, although Firefox should probably learn how to deal with it.

However, you may want to look at whether Dojo is doing what it should here.

Maybe Dojo is doing:
1) Append div, 2) replace table, 3) hide div, 4) show div  ?

It seems to be #3 that's causing the extra menupopupend.
I've done some investigating and here is what Dojo is doing:

1. creates a "wrapper" div []
2. appends the div to body []
3. changes the table style.display from "none" to "" []
4. appends the table to the div []
5. changes the div style.visibility from "" to "hidden" [dijit._place()]
6. changes the div style.visibility back to "" [dijit._place()] is in

dijit._place() is in
I've created a ticket on Dojo's trac to note the issue there:
Why is the <div> wrapper needed?

It would help if the outer thing being made visible and hidden had role menu. Either:
- get rid of the extra div, or 
- put the menu role on the div and role=presentation on the table

That would help in the short term, but in the long term Mozilla probably needs to deal with weird stuff like this.
It's not clear to me that the <div> wrapper is needed. I'll look into it.
Pleas keep the old version around too, it's a perfect stress test for our code.

We need to ensure perfectly symmetrical popupstart and popupend events on Windows, and this makes that quite difficult! :)
This solution was too brittle .... frustrating.

We need to keep track of an array of currently opened menupopups, and make sure that we only fire menupopupend events for them, and only once. We only need to look for menupopupend events when there are any open menupopups in that array.

Time to move on to another bug for now-- it's taking too long. We can revisit it later but I need to work on other bugs.

Simon, I recommend trying to fix this on the Dojo side for now.
Aaron, please make sure that MENUPOPUPEND is sent *before* MENUEND events. Right now, Minefield sends them in the wrong order: First the MENUEND, then an OBJECT_FOCUS to the elemtnt that the context menu was created for, then a MENUPOPUPEND. This way, JAWS never recognizes that the menus have closed. So, the END events must follow in the reverse order the START events were fired, e. g. first a MENUSTART, then a MENUPOPUPSTART, has to be MENUPOPUPEND, then MENUEND.
I've made a small Dojo patch that removes the extra MENUPOPUPEND:

However, there are still extra events. The menu open is generating 7 MENUPOPUPSTARTs. To see the patch applied please visit:
I've committed the change to Dojo discussed in comment 13 above:

I've opened a new ticket for the 7 MENUPOPSTARTs:
(In reply to comment #14)
> I've opened a new ticket for the 7 MENUPOPSTARTs:

Note: fixed in bug 413675
I think we've done all we are going to do on this bug. Good work happened on other bugs/tickets. Closing as WORKSFORME.
Assignee: aaronleventhal → david.bolter
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.