From 23aaee787a1e5381f9ac87da7b1cb717860dedf1 Mon Sep 17 00:00:00 2001 From: Alexandr Melnychuk Date: Tue, 25 Jan 2022 17:42:23 +0200 Subject: [PATCH 1/2] Github issue 34886: Fixed work close button and "preventDefault inside passive event" error in console. --- lib/web/fotorama/fotorama.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js index 0c4ecebcada51..5c8fdc3b4af54 100644 --- a/lib/web/fotorama/fotorama.js +++ b/lib/web/fotorama/fotorama.js @@ -1140,7 +1140,13 @@ fotoramaVersion = '4.6.4'; function addEvent(el, e, fn, bool) { if (!e) return; - el.addEventListener ? el.addEventListener(e, fn, {passive: true}) : el.attachEvent('on' + e, fn); + const passiveEvents = ['wheel', 'touchstart', 'touchmove']; + const options = { + get passive() { + return passiveEvents.includes(e); + } + } + el.addEventListener ? el.addEventListener(e, fn, options) : el.attachEvent('on' + e, fn); } /** From df18627dd0ceb570a46d8ba4ae7fac0dc34665c9 Mon Sep 17 00:00:00 2001 From: Alexandr Melnychuk Date: Wed, 26 Jan 2022 15:22:56 +0200 Subject: [PATCH 2/2] Github issue 34886: Returns value "true" of property "passive" for only "wheel" event. --- lib/web/fotorama/fotorama.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/web/fotorama/fotorama.js b/lib/web/fotorama/fotorama.js index 5c8fdc3b4af54..fe794e98ac1f2 100644 --- a/lib/web/fotorama/fotorama.js +++ b/lib/web/fotorama/fotorama.js @@ -1140,10 +1140,9 @@ fotoramaVersion = '4.6.4'; function addEvent(el, e, fn, bool) { if (!e) return; - const passiveEvents = ['wheel', 'touchstart', 'touchmove']; const options = { get passive() { - return passiveEvents.includes(e); + return e === 'wheel'; } } el.addEventListener ? el.addEventListener(e, fn, options) : el.attachEvent('on' + e, fn);