HierMenus CENTRAL: HierMenus In Progress. HM5 Status Report: Adding Opera (5/5)
[previous] |
The Missing MouseUp: Tried Solutions
Here are some of the things we tried to work around the missing mouseup problem described on the previous page:
Capture during propagation
If you dug into the code of the previous page, you may have noticed that we're assigning the handlers as default handlers, to be activated during the bubbling phase of the event; i.e.:
function docMUp() {
dw(1,'Mouse is Up');
return true;
}
function docMDown() {
dw(1,'Mouse is Down');
return true;
}
...
document.addEventListener('mousedown',
docMDown,
false);
document.addEventListener('mouseup',
docMUp,
false);
...
We also tried to capture the events in the propagation phase; and received either the same, or in some cases, less mouseup events triggered. On a curious side note, we found that Opera seems to support the IE-like attachEvent and detachEvent methods. We tried using these to attach our handlers, but with the same results.
Return false
We tried explicitly returning false from our handlers; as opposed to returning true as in the above code. Additionally, we tried various combinations of stopPropagation and preventDefault, which each had their own specific effects on the outcome; but we could find no combination that allowed for the mouseup events to be displayed consistently after dragging.
Trapping onSelect
A final attempt to grab the mouseup was to trap the select event, hoping that if we saw it, we could use it to signal the end of the mouse activity. However, the select event fires only when text is being selected in an input or textarea field of a form; thus it would not cover all of our possible needs. (This is not surprising, as this is the behavior specified in the DOM standard for the onselect event.) Besides, when the select event did fire as a result of selecting text in a form field, the mouseup also seemed to fire fine, removing the initial problem in the first place.
Conclusion
Even with these minor problems, we remain impressed with the overall effort and results of Opera 7, and plan to include the described changes to support it in our next HM version. We're currently hard at work implementing the next most requested feature of HM: the ability to create links in one frame that, when rolled over, display pop-up menus in the second frame. Stay tuned, and we'll keep you posted on the continuing developments!
Created: March 12, 2003
Revised: March 12, 2003
URL: https://www.webreference.com/dhtml/hiermenus/inprogress/1/5.html