(BUG) element.html - Links magically shift (when many?).

I have an element into which I set a string of HTML using $w(element).html = HtmlString.

Got a problem with that though - Sometimes it loads shifted.

I will provide a simplified code with example -

I have a string of HTML links with their labels.

<a href="/translation_afrikaans_english">Afrikaans</a>
<a href="/translation_albanian_english">Albanian</a>
<a href="/translation_arabic_english">Arabic</a>

and I assign them into a .html on the element.

$w("#footerLinks").html = htmlLinks

Then on the page it looks like this:

BUT! Sometimes (and those cases are quite often) it happens so that when you click on for example Afrikaans, there is no link, but Albanian links to Afrikaans and Aramaic links to Albanian (simply put they are shifted by 1 index)

So the code on the client website actually looks like this:

 <a href="">Afrikaans</a> 
 <a href="/translation_afrikaans_english">Albanian</a> 
 <a href="/translation_albanian_english">Arabic</a> 

The shifting can happen in the opposite direction as well. Or it sometimes happened that the links were shifted by 2 indexes.

This is a simple .html SET. And therefore there is nothing that can be doing this on my side. The WixCode processes the .html and returns it in their “edited format” apparently. And there is a bug which shifts the indexes while this assign is happening.

This is a big problem for us, please fix this issue Wix. I already reported the bug using the report issue form, but there is no response or anything from Wix developers. I hope someone will see and care about this problem. Thanks for whoever that is. If there is…

Nothing should happen to an HTML string. Very strange. Do you have code that references the string variable htmlLinks ?

Please post the editor URL of your site. Only authorized Wix personnel can get access to your site in the editor. Please include the name of the page involved.

I have this a bit complex, but nothing happens with the string after its ok (which is always when I log it). And when I was testing this, I did the easiest thing there is to do and it still happened. This is a case where it happens as well (on the same frequency actually, how I write the code has no impact ):

const languagesFooterHtml = '<a href="translation_afrikaans_english">Afrika...' //the content is very long and I believe there is no need to include it
$w("#languagesFooter).html = languagesFooterHtml

With these 2 lines there is I am certain nothing that would cause this from my side.

The webpage is https://www.hero-translating.com/ and you can yourself have a look. (Load the main page, hover over the links in the footer and you will see they should be ok [they usually are at the first load] and then switch to a subpage COMPANY.

Then go and hover over the links again. Chances are very high that you will have the links shifted. If not, just clicking through the content, randomly reloading will get you there soon. I tried this on many computers, more developers than I tried to solve this, but only when I tested it in a way which couldn’t be wrong I found out it actually doesn’t happen in my code but in the .html processing or wherever else.

First of all, I don’t see the problem. I go to the site and when I check the links they are fine. Then I switch to other pages and check the links and they’re fine. I go back to the main page and the links are still OK.

I did see this which is a bit disconcerting:


Errors are not good. Of course.

Where is the code that sets languagesFooterHtml ? I can’t find it.

I also see that your languagesFooterHtml string isn’t just a simple string. As best as I can tell, you are performing a fetch to a third party service to retrieve the list of languages and then building the string. I suspect that there’s something going on that you’re not aware of.

Please understand that we are unable to debug or rewrite complex code and page configurations. If you feel that there is a bug in Wix Code, then please try to create a test page with the minimum scenario in which the problem appears to help us investigate the issue properly.

I put back the fetch, but before I was testing it with a simple string as I wrote above. Never the less if you would log the string before it is assigned to the html, in all cases the string is ok.

This issue is happening on all computers we tried it on. And they were about 10 (tested with Chrome).

Further I don’t see any such error that appears on your side, my console results error-less (except fo those I have tryCatched for purpose):

Are you testing it while loading it as a common user would? From your screenshot it appears like you are in some sort of a developer debug / preview…, that surely works differently…

I will create another page in the router which will contain just what is relevant. I will send you the link here once I done that. (Tomorrow)

For now just thanks for investigating the issue, let’s hope we can come to some conclusion.

@yisrael-wix This was how I tested it before, I switched it back to the live fetching because the page is in production and I didn’t want to leave it not working as it should.

" Please include the name of the page involved. "

we put this into our footer, its on the site code

@franek “Further I don’t see any such error that appears on your side, my console results error-less (except fo those I have tryCatched for purpose):”

Hmmm, what is the TypeError?

“in some sort of a developer debug / preview…, that surely works differently…”

Yes, I was running in the Editor (same place you used to develop the site)) so I could follow what’s going on.

I also tried your site as-is (not in the Editor) and had no shifting take place. I navigated around the site and whenever I would click on the links they appeared to be OK.

Whatever you can do to simplify the scenario would be most helpful.

@yisrael-wix the TypeError is when this function:

logs in the console and it just logs the unsuccessful attempts, but as it is tryCatched it isn’t causing any problems. I turned that off.

Now I did this on the Site Code on lines 140 - 151 , you can check it there - It only applies in the english version of the websites, the links are loaded directly from this string in there. I even log them into console right before I do the .html assign.

The console log will tell you that the links are correct. As I said before, no problem is happening on my side, so there is surely nothing you will see here. Except for the fact it shouldn’t be happening.


It happens to me almost every time I try . If you didnt encounter the problem, that is certainly just some coincidence. Please have a look again and if you still can’t see it, I can record it and post a video of it. It happens on our clients side as well, so it’s not just some bug of my browser of course.

You can see the issue once it appears, when you hover over the links the link will lead totally elsewhere than it does in the code.

Note: This issue only happens when the links are in the footer. That is why I can’t create a test page unless I create completely new wixsite. I can do that and try to replicate the issue if you think that would be helpful though…

The issue occurs when you are switching between pages or whatever like that. Though sometimes it doesn’t occur at all.

@franek After about an hour of playing around, I finally see it happening. :exploding_head: I have no idea what to do with this, but I will discuss this with QA to see if they can help identify a bug.

Stay tuned.

@yisrael-wix thats great to hear. I really appreciate you taking the time to investigate!