Control.ContextMenu position not assigned correctly
Reported by Christoph Ambichl | July 28th, 2009 @ 10:34 PM | in 1.0
If the viewport_scroll_offsets are not 0 (the page is scrolled
down/right), the container positions are not assigned correctly.
This only happens with right clicks, left clicks work as expected.
I have experienced this problem with Firefox 3 and Safari 4.
Event.pointerY does not return the expected result for a right
clicks as described in the API
(Prototype 1.6.0.3).
My quick workaround in contextmenu.js:
Object.extend(Control.ContextMenu,{
<...>
positionContainer: function(event){
var dimensions = Control.ContextMenu.container.getDimensions();
var top = Event.pointerY(event);
var left = Event.pointerX(event);
var bottom = dimensions.height + top;
var right = dimensions.width + left;
var viewport_dimensions = document.viewport.getDimensions();
var viewport_scroll_offsets = document.viewport.getScrollOffsets();
// add offset if there is a right click
if(event.isRightClick()) {
top += viewport_scroll_offsets.top;
left += viewport_scroll_offsets.left;
}
if(bottom > viewport_dimensions.height + viewport_scroll_offsets.top) {
top -= bottom - ((viewport_dimensions.height + viewport_scroll_offsets.top) - Control.ContextMenu.offset); }
if(right > viewport_dimensions.width + viewport_scroll_offsets.left) {
left -= right - ((viewport_dimensions.width + viewport_scroll_offsets.left) - Control.ContextMenu.offset); }
Control.ContextMenu.container.setStyle({
top: top + 'px',
left: left + 'px'
});
}
});
Comments and changes to this ticket
-
Nathan L Smith July 31st, 2009 @ 01:15 PM
- Assigned user cleared.
- State changed from new to unconfirmed
-
Nathan L Smith August 13th, 2009 @ 08:20 PM
- Assigned user set to Ryan Johnson
- State changed from unconfirmed to invalid
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
NOTE: Please do not open tickets here. If you have an issue, please open it on http://github.com/syntacticx/livepipe-ui/issues/
High quality widgets and controls for web 2.0 applications built using the Prototype JavaScript Framework. Each control is well tested, highly extensible, fully documented and degrades gracefully for non JavaScript enabled browsers where possible. MIT licensed and actively maintained.