SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.95k stars 1.23k forks source link

sap.m.Carousel causing Unable to preventDefault inside passive event error on touch devices #3743

Closed apolesskiy01 closed 1 year ago

apolesskiy01 commented 1 year ago

OpenUI5 version: 1.108.3, 1.108.9

Browser/version (+device/version): Version 112.0.5615.138 (Official Build) (64-bit), Windows 10

Any other tested browsers/devices(OK/FAIL): Not tested

URL (minimal example if possible):

User/password (if required and possible - do not post any confidential information here):

Steps to reproduce the problem:

  1. sap.m.Carousel with more than 1 page
  2. Use Google Chrome debug mode and switch to "mobile device" view
  3. Swipe carousel pages left or right.
  4. Console generates number of "Unable to preventDefault inside passive event" error messages

What is the expected result? No error messages in the console

What happens instead? Error messages displayed on every shift of the carousel

Any other information? (attach screenshot if possible) The issue is caused by "e.preventDefault();" statement in self._fnDrag function under Carousel.prototype.bind function in mobify-carousel.js file (currently line 427) The easiest fix is:

  1. Add parameter e.g. "touch", to the self._fnDrag function. e.g self._fnDrag = function drag(e,touch)
  2. Update line 427 "e.preventDefault();" to "if( !touch ) e.preventDefault();"
  3. In function Carousel.prototype.touchmove update line 340 "this._fnDrag.call(this, e);" to "this._fnDrag.call(this, e, true);" So, it is look like the following: Carousel.prototype.touchmove = function(e) { // BEGIN: MODIFIED BY SAP if (jQuery(e.target).is("input, textarea, select, [contenteditable='true']")) { return; } // END: MODIFIED BY SAP

    if(this._fnDrag) {
        this._fnDrag.call(this, e, true);
    } else {
        jQuery.sap.log.warning("Mobify's 'drag' method not available yet.")
    }

    }

tsanislavgatev commented 1 year ago

Hello @apolesskiy01,

Thank you for sharing this finding. I've created an internal incident 2370050847. The status of the issue will be updated here in GitHub.

Regards, Tsanislav

kskondov commented 1 year ago

Hi @apolesskiy01, the issue is fixed in the master branch