Changeset 8425
- Timestamp:
- 05/04/07 12:38:35 (21 months ago)
- Location:
- dijit/trunk
- Files:
-
- 3 modified
-
Menu.js (modified) (4 diffs)
-
tests/test_Menu_Debuggable.html (modified) (3 diffs)
-
util/PopupManager.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
dijit/trunk/Menu.js
r8413 r8425 123 123 // return true to stop the event being processed by the 124 124 // parent popupmenu 125 126 125 if(evt.ctrlKey || evt.altKey || !evt.keyCode){ return false; } 127 126 … … 219 218 node = dojo.withGlobal(win, dojo.body); 220 219 } 221 222 dojo.addListener(node, "contextmenu", this, this.open); 220 221 // to capture these events at the top level, 222 // attach to document, not body 223 var cn = (node == dojo.body() ? dojo.doc : node); 224 node[this.widgetId+'connect'] = [ 225 dojo.connect(cn, "oncontextmenu", this, "open"), 226 dojo.connect(cn, "onkeydown", this, "_contextKey") 227 ]; 223 228 }, 224 229 … … 226 231 // summary: detach menu from given node 227 232 var node = dojo.byId(nodeName); 228 dojo.removeListener(node, "contextmenu", this.open); //PORT fix 3rd arg (handle) 233 dojo.forEach(node[this.widgetId+'connect'], dojo.disconnect); 234 }, 235 236 _contextKey: function(e){ 237 if (e.keyCode == dojo.keys.F10) { 238 dojo.stopEvent(e); 239 if (e.shiftKey && e.type=="keydown") { 240 // FF: copying the wrong property from e will cause the system 241 // context menu to appear in spite of stopEvent. Don't know 242 // exactly which properties cause this effect. 243 var _e = { target: e.target, pageX: e.pageX, pageY: e.pageY }; 244 _e.preventDefault = _e.stopPropagation = function(){}; 245 // IE: without the delay, focus work in "open" causes the system 246 // context menu to appear in spite of stopEvent. 247 window.setTimeout(dojo.hitch(this, function(){ this.open(_e); }), 1); 248 } 249 } 229 250 }, 230 251 … … 247 268 // summary 248 269 // Open menu relative to the mouse 270 dojo.stopEvent(e); 249 271 dijit.util.PopupManager.open(e, this); 250 dojo.stopEvent(e);251 272 this._highlightOption(1); 252 273 }, -
dijit/trunk/tests/test_Menu_Debuggable.html
r8403 r8425 13 13 djConfig = { isDebug: true, baseUrl: "../../dojo/" }; 14 14 </script> 15 15 16 <script type="text/javascript" src="../../dojo/_base/_loader/bootstrap.js"></script> 16 17 <script type="text/javascript" src="../../dojo/_base/_loader/loader.js"></script> … … 31 32 <!--<script type="text/javascript" src="../../dojo/dojo.js" djConfig="isDebug: true, debugAtAllCosts: true"></script>--> 32 33 34 <script type="text/javascript" src="../util/PopupManager.js"></script> 33 35 <script type="text/javascript" src="../Menu.js"></script> 34 36 <script type="text/javascript" src="../util/parser.js"></script> … … 38 40 dojo.require("dijit.util.parser"); // scan page for widgets and instantiate them 39 41 </script>--> 42 40 43 </head> 41 44 <body class="tundra"> -
dijit/trunk/util/PopupManager.js
r8403 r8425 22 22 23 23 var x = e.pageX, y = e.pageY; 24 // FIXME: consider skipping everything up to _open 25 // if x == y == 0, allowing the popup to appear 26 // wherever it was last time. 24 27 var win = dijit.util.window.getDocumentWindow(e.target.ownerDocument); 25 28 var iframe = win._frameElement || win.frameElement;