contextmenu.js revision f856a43636b28d436393ba16bcbe9016ebf7a59a
/**
* Provides extended keyboard support for the contextmenu event such that:
* 1) On Windows there is a uniform experience regardless of how the contextmenu is fired via the keyboard (either via the Menu key or using Shift + F10)
* 2) On the Mac it enables the use of the Shift + Control + Option + M keyboard shortcut, which (by default) is only available when VoiceOver is enabled.
* 3) When the contextmenu event is fired via the keyboard, the pageX, pageY, clientX and clientY properties are set using the center of the event target as the point of origin. This makes it easier for contextmenu event listeners to position an overlay in respose to the event by not having to worry about special handling of the x and y coordinates based on the device that fired the event.
* @module event-contextmenu
* @requires event
*/
map = {},
conf = {
handles = [];
if (data) {
}
}, node]));
clientX = 0,
clientY = 0,
xy,
x,
y;
// Prevent IE's menubar from getting focus when the user presses Shift + F10
e.preventDefault();
}
x = xy[0];
y = xy[1];
// Protect against instances where xy and might not be returned,
// for example if the target is the document.
if (!Y.Lang.isUndefined(x)) {
}
// Fixes two issues:
// 1) IE 9 doesn't set pageX and pageY for simulated events (bug #2531581)
// 2) The contextmenu doesn't provide clientX, clientY, pageX or pageY when fired via the Menu key
map[node.generateID()] = { clientX: clientX, clientY: clientY, pageX: (clientX + scrollX), pageY: (clientY + scrollY) };
}
// Don't need to simulate the contextmenu event when the
// menu key is pressed as it fires contextmenu by default.
if (!menuKey) {
button: 2,
});
}
}
}, filter));
},
});
}
};