From 7a94baeb94781e8aba2ba104394ddab879bc83b7 Mon Sep 17 00:00:00 2001 From: Fabian Franz Date: Tue, 29 Nov 2016 05:58:49 -0800 Subject: [PATCH] Issue #2821441 by davic, droplet, David_Rothstein, Joe Keene, Fabianx, tory-w: Fixed that newer Chrome versions cannot drag and drop anymore on desktop after 7.51 update when jQuery is updated to 1.7-1.11.0 --- CHANGELOG.txt | 2 ++ misc/tabledrag.js | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e996e50cb9b..94291c7a102 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,8 @@ Drupal 7.53, xxxx-xx-xx (development version) - Modules are now able to define theme engines. - Numerous bug fixes. +- Fixed drag and drop support on newer Chrome/IE 11+ versions after 7.51 update + when jQuery is updated to 1.7-1.11.0. Drupal 7.52, 2016-11-16 ----------------------- diff --git a/misc/tabledrag.js b/misc/tabledrag.js index 4e07784c7df..7ea88b607a1 100644 --- a/misc/tabledrag.js +++ b/misc/tabledrag.js @@ -580,12 +580,20 @@ Drupal.tableDrag.prototype.dropRow = function (event, self) { * Get the mouse coordinates from the event (allowing for browser differences). */ Drupal.tableDrag.prototype.mouseCoords = function (event) { + // Complete support for pointer events was only introduced to jQuery in + // version 1.11.1; between versions 1.7 and 1.11.0 pointer events have the + // clientX and clientY properties undefined. In those cases, the properties + // must be retrieved from the event.originalEvent object instead. + var clientX = event.clientX || event.originalEvent.clientX; + var clientY = event.clientY || event.originalEvent.clientY; + if (event.pageX || event.pageY) { return { x: event.pageX, y: event.pageY }; } + return { - x: event.clientX + document.body.scrollLeft - document.body.clientLeft, - y: event.clientY + document.body.scrollTop - document.body.clientTop + x: clientX + document.body.scrollLeft - document.body.clientLeft, + y: clientY + document.body.scrollTop - document.body.clientTop }; };