Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4152

FF drag from inside div with overflow:auto fails to drop

XMLWordPrintable

      Steps to Reproduce

      run the attachment dnd-FF-overflow.zul

      drag the labels from both red and green div and drop on the blue target area

      Current Result

      in FF the drop doesn't trigger when dragged from the div with overflow auto...

      also the .z-drag-over style class is not added to the drop target while dragging over

      Expected Result

      working DnD

      Debug Info

      this still worked in 8.0.1.1 and fails since 8.0.2

      Root Cause

      same reason as ZK-3518 just all other overflow types besides 'visible' have the problem on FF

      https://github.com/zkoss/zk/blob/v8.6.0.1/zk/src/archive/web/js/zk/widget.js#L283
      condition should be !== 'visible'

      Workaround

      	zk.afterLoad('zk', function() {
      		function isFFOverflowBug(evt) {
      			// Firefox's bug -  https://bugzilla.mozilla.org/show_bug.cgi?id=1259357
      			return zk.ff && jq(evt.domTarget).css('overflow') !== 'visible';
      		}
      		function isIEImageTagBug(evt) {
      			// IE 9~11 and Edge may receive a wrong target when dragging with an Image.
      			return (zk.ie > 8 || zk.edge) && jq.nodeName(evt.domTarget, 'img');
      		}
      		zk.DnD.getDropTarget = function (evt, drag) {
      			var wgt;
      			if (isFFOverflowBug(evt) || isIEImageTagBug(evt)) {
      				var n = document.elementFromPoint(evt.domEvent.clientX, evt.domEvent.clientY);
      				if (n)
      					wgt = zk.$(n);
      			} else {
      				wgt = evt.target;
      			}
      			return wgt;
      		}
      	});//zk.afterLoad
      

            CharlesQiu CharlesQiu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Time Spent - 1 hour, 30 minutes Remaining Estimate - 6 hours, 30 minutes
                6h 30m
                Logged:
                Time Spent - 1 hour, 30 minutes Remaining Estimate - 6 hours, 30 minutes
                1h 30m