Failing in setting textarea value from sidebar.html file

I am developing Google Docs addon, in which I am periodically checking for selected text and updating a textarea in sidebar.html file. Everything works fine as long as the user domain/email is

If a user comes from a Google Workspace email address (not ending with, the same piece of code is failing with error:

Blocked autofocusing on a <div> element in a cross-origin subframe.

Here is the code to get selected text in Google doc and update the textarea in sidebar.html file.

setInterval(function() { {
  }, 1000);

The getSelectedText() function can be seen here.

I believe this is a cross-origin issue. Please suggest any fix.