Skip to main content

Search and Top Navigation

#7925 closed bug (notabug)

Opened November 30, 2011 10:45PM UTC

Closed January 04, 2012 05:19PM UTC

Last modified September 14, 2016 01:57PM UTC

droppable prepareOffsets sets incorrect offset when droppable is in an iframe

Reported by: reevesm Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.droppable Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:
Description

version: jquery-ui-1.8.14

browser: chrome

os: windows

To reproduce:

1. Create a draggable element using jQueryUI draggable API outside of your iframe

2. Create droppable elements within an iframe (iframe is in middle of the page) on the same page and alert when element is dragged over the droppable within the iframe.

var body = $('#iframe').contents().find('body');

$(body).droppable({

over:function(event,ui) {

alert('over droppable');

}

});

Result:

The alert will not fire when dragging over the iframe but will fire when the element is dragged into a position above the iframe

Expected Result:

The alert fires when dragging over the body element in the iframe.

See $.ui.ddmanager.prepareOffsets. It appears that m[i].offset is incorrect.

Attachments (0)
Change History (12)

Changed January 04, 2012 05:19PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

We don't support cross-window dragging.

Changed January 11, 2012 11:51PM UTC by ddphoto comment:2

I had implemented a workaround to enable drag&drop with iframe.

in $.ui.ddmanager.prepareOffsets I change the offset to handle the iframe scrolling & the iframe position.

juste after m[i].offset = m[i].element.offset();

  // handle iframe scrolling
  m[i].offset.top -=  m[i].element.parents().find("html,body").scrollTop();
  m[i].offset.left -=  m[i].element.parents().find("html,body").scrollLeft();

  // iframe positioning 
  if( this.current.options.iframeOffset )
  {
    m[i].offset.top +=  this.current.options.iframeOffset.top;
    m[i].offset.left +=  this.current.options.iframeOffset.left;
  }

where iframe offset come from the draggable option like

$( "div" ).draggable({
  iframeFix: true, 
  appendTo: 'body',
  containment: 'window',
  helper: "clone",
  iframeOffset: $("#frame").offset()
 });

Tested on FF 8.0.1 & Chrome 16

Changed July 11, 2013 01:35PM UTC by scottgonzalez comment:3

#9421 is a duplicate of this ticket.

Changed February 24, 2015 01:38PM UTC by scottgonzalez comment:4

#11204 is a duplicate of this ticket.

Changed February 25, 2015 06:52AM UTC by gaurav comment:5

Replying to [comment:4 scott.gonzalez]:

#11204 is a duplicate of this ticket.

Hello scott.gonzalez,

Could you please visit ticket number 11204 its not duplicate of 7925.

I still getting issue. when iframe document reloads in IE10.

Please look into it once again and open the ticket.

Thanks

Gaurav Teli

Changed February 25, 2015 12:32PM UTC by scottgonzalez comment:6

Please read the first comment on this ticket and look at the status of the ticket. Regardless of whether this happens to work in Chrome right now, this is not something we support.

Changed February 25, 2015 03:17PM UTC by scottgonzalez comment:7

#11222 is a duplicate of this ticket.

Changed February 26, 2015 10:35AM UTC by gaurav comment:8

Replying to [comment:6 scott.gonzalez]:

Please read the first comment on this ticket and look at the status of the ticket. Regardless of whether this happens to work in Chrome right now, this is not something we support.

Hello Scott.Gonzalez:

I am very much agree with you. I want to say it's working first time as expected. So It should work on 2nd time rendering also.

I am struck in key task. If possible please try to put some focus or guide me.

Thanks

Gaurav

Changed January 25, 2016 03:26PM UTC by scottgonzalez comment:9

#14906 is a duplicate of this ticket.

Changed April 25, 2016 05:36PM UTC by scottgonzalez comment:10

#14953 is a duplicate of this ticket.

Changed May 10, 2016 05:01PM UTC by scottgonzalez comment:11

#14964 is a duplicate of this ticket.

Changed September 14, 2016 01:57PM UTC by scottgonzalez comment:12

#15047 is a duplicate of this ticket.