- From: Matthew Raymond <mattraymond@earthlink.net>
- Date: Thu, 24 Jun 2004 06:41:03 -0400
David Hyatt wrote: > Note that there are really two kinds of menus... DHTML popup menus that > should support CSS styles and be similar to DHTML menus on the Web today It's hard to tell by the structure of your email, but I think you mean that the two kinds of menus are standard menus and popup menus. It should be noted that my previous sample code did not take popup menus into consideration. To be honest, I kinda like the way XUL does popup menus. In XUL, everything's done in XML. Here's an example I stole from XULPlanet: ----------------------- <popupset> <popup id="clipmenu"> <menuitem label="Cut"/> <menuitem label="Copy"/> <menuitem label="Paste"/> </popup> </popupset> <box context="clipmenu"> <description value="Context click for menu"/> </box> ----------------------- I have a slightly simpler idea, which I'll come to in a moment. > (I believe these should be specifiable just on <ul>/<li> entirely using > CSS, e.g., with new display types). I presume you mean using pure CSS menus in combination with Dean Edwards' IE7. [Matthew thinks about it for a moment...] Yeah, I'll buy that. It doesn't provide a solution for keyboard shortcuts and the lot, but then you'd have to deal with conflicts with the browser menus anyway. The only problem here is that we'd still need Javascript and DOM to get popups working. In that regard, I have the following idea: ----------------------- <div style="display: none; margins: 0px"> <div id="myContextMenu"> ...Menu Stuff... </div> </div> <span context="myContextMenu">Hello World!</span> ----------------------- The way this works is simple. When you right-click (or whatever click you use to get a context menu in your OS) anywhere inside the <span> element, the element with the ID specified in the context attribute temporarily becomes the child of the <span>. When the temporary child element is clicked or looses focus, it's automatically returned to its original parent. The context attribute could be specified in just about any element and would work in a similar way. If someone tries to use this feature maliciously to block access to the browser context menus, the user could simply use popup blocking to disable the context attribute.
Received on Thursday, 24 June 2004 03:41:03 UTC