Error with onClick on mobile, bug?

Hi team,

I have come across an error with using onClick (coded) it only seems to be on mobile. I changed to using the onClick via properties panel and then it worked. The original code had been functioning for at least 1 year.

You should add more details.

This doesn’t work

$w.onReady(function () {
 $w('#reviewsButtonMobile').onClick((event) => {     
           $w('#reviewsBox').scrollTo();
 }); 
});

This does work

export function reviewsButtonMobile_click(event) {
    $w('#reviewsBox').scrollTo();
}

But only having problems on mobile

@stephenmccall is it a Button ? Are you sure it’s not linked via the editor?

@jonatandor35 It is a button and it isn’t connected via the editor. As I mentioned I has been working for over 1 year. It was just brought to my attention a few days back. Only on mobile though.

@stephenmccall sounds like a question for Wix mods.

Is it all mobile devices or just one browser?

Also, as you have the element listed as reviewsButtonMobile, do you have different buttons setup for desktop and mobile only versions using form factor and something like this in your code

if(wixWindow.formFactor === "Mobile"){

Otherwise, as it is mobile only, it does sound more likely that David’s answer above could be the one main reason why it is not working.

As it might just be the one mobile browser that is being affected and that browser simply just does not let the event handler function run through the code itself and you must manually put the onClick handler in yourself manually.

That can happen when devs update things and I am sure that all here can tell you when devs have updated their browsers only for something within Wix Corvid not to be able to work in the latest version. :wink: