diff --git a/core/modules/contextual/js/views/RegionView.js b/core/modules/contextual/js/views/RegionView.js index e960db3..55afd17 100644 --- a/core/modules/contextual/js/views/RegionView.js +++ b/core/modules/contextual/js/views/RegionView.js @@ -3,7 +3,7 @@ * A Backbone View that renders the visual view of a contextual region element. */ -(function (Drupal, Backbone, Modernizr) { +(function (Drupal, Backbone) { 'use strict'; @@ -16,16 +16,30 @@ * A mapping of events to be used in the view. */ events: function () { + + // We don't want mouse hover events on touch. + var istouchStart = false; var mapping = { - mouseenter: function () { this.model.set('regionIsHovered', true); }, + mouseenter: function (e) { + if(!istouchStart) { + istouchStart = false; + this.model.set('regionIsHovered', true); + } + }, mouseleave: function () { - this.model.close().blur().set('regionIsHovered', false); + if(!istouchStart) { + istouchStart = false; + this.model.close().blur().set('regionIsHovered', false); + } + }, + touchstart: function () { + istouchStart = true; + }, + mousemove: function () { + istouchStart = false; } }; - // We don't want mouse hover events on touch. - if (Modernizr.touchevents) { - mapping = {}; - } + return mapping; }, @@ -54,4 +68,4 @@ }); -})(Drupal, Backbone, Modernizr); +})(Drupal, Backbone);