Forum Discussion

VarshaTiwari's avatar
VarshaTiwari
Copper Contributor
Apr 17, 2025

Event Listeners Not Working After Translating SharePoint Page with SPFx Extension

Hello everyone,

I'm developing a SharePoint Framework (SPFx) extension to translate SharePoint pages using a language viewer API. The extension includes a dropdown menu for language selection, and it successfully translates the page content based on the selected language. However, after the translation, all event listeners attached to elements on the page, such as the "Add New" functionality of the out-of-the-box (OOTB) list web part, stop working.

Here are the steps I've taken so far:

  1. Reattached event listeners after applying translations.

Despite these efforts, the issue persists. Has anyone encountered similar problems or have any suggestions on how to resolve this? Any insights or solutions would be greatly appreciated!

Thank you in advance for your help!

1 Reply

  • Hi Varsha,

    I'm sorry to rain on your parade, but when our company first developed our PointFire page translation app, we found that this approach causes this problem and several others.  Some issues are specific to some languages, and some will affect one page and not a seemingly identical page.  Fundamentally, changing the DOM on a page as it is being rendered is a dangerous technique which should be avoided.  SharePoint has a lot of html that translation engines don't like and that will break SharePoint if you change it.

     

Resources