Gravatar for dipsindol@gmail.com

Question by DEEPTHI KATTA, Jan 3, 2017 6:58 PM

Slider Event Issues on Mobile

Hi There…We currently have an issue where Sliders are not working on Mobile. Debugging, we found out on the below snippet from CoveoJsSearch.WithDependancies.js e['originalEvent'] is null instead the co-ords needed are existing in 'e.touches[0]'. Is this a bug? If yes, we obviously do not want to edit the core coveo JS file. Is there a workaround?

 SliderButton.prototype.getMousePosition = function (e) {
        var posx = 0;
        var posy = 0;
        if (this.eventMouseMove == 'touchmove') {
            posx = e['originalEvent']['touches'][0].pageX;
            posy = e['originalEvent']['touches'][0].pageY;
        }
        else if (e.pageX || e.pageY) {
            posx = e.pageX;
            posy = e.pageY;
        }
        else if (e.clientX || e.clientY) {
            posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
        }
        return { x: posx, y: posy };
    };
1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Jan 4, 2017 9:06 AM

Hi,

this is indeed a bug that we found recently, and has already been fixed in the master branch of the product.

Unfortunately, this also means that since it was fixed very recently in development, it is still not available for Coveo for Sitecore or Coveo for Salesforce product.

The short term solution is to either use the development version of the Coveo UI (if you are still in development) , or to override the prototype method and change it to add the bugfix that we did : https://github.com/coveo/search-ui/blob/master/src/ui/Misc/Slider.ts#L433

The other solution is to wait for the official product fix to be released.

Thank you for reporting this.

Ask a question