Doing actions in one Word document should NEVER affect another Word Document
When an addin scans a document for changes, it affects ALL open documents, including removing highlight and discarding your cursor even if you're working in an entirely different Word window (without the addin).

Here I select and click highlight in one word document. Holding down the highlight button in order to "time it perfectly" until the other word document's addin scans for changes. When I release the highlight button after the scan, the OTHER document is highlighted--somewhere I didn't even click.
Note that my example addin scans the document every few seconds making this easy to reproduce. I can provide code for a concise example Add-In that produces this issue, but I don't think it is necessary. This is the key part of such code:
```
context.load(contentControls, 'tag,title');
return context.sync().then(() => {
````
Notably, this does not appear to be an issue with Add-Ins specifically, but an issue with Word Isolation. This is demonstrated by the functionality in this add-in, but it is probably in the core Office code. That said, I had no idea where else to put this bug report, so here it is.
In the real world, we're producing an addin that needs to know when the document has changed and given the limited events, we have elected to scan tho document on an event loop (every 5 seconds) and this disorients and confuses the user in actual practice.
nearly a month. Can I get a "we're looking into it" or something?
just checking in...still an issue...seeing it perpetuate other problems now too...this sandboxing is kinda a big deal.
sorry about the delay .... just to let you know in the next minutes we will provide an update i think i have seen this before.... stay tuned...
ok @deltreey , after years of waiting (jk :) ) i have to say, i can NOT repro the issue. (not to mention sounds like an edge case, but we should also look into those 馃憤 )
I prepared a script lab snippet for your so you can try it on your end. Btw if you are new to script lab go here: http://aka.ms/scriptlab
So please load it, run it, click setup (this will add 2 paragraphs with a content control ) then click "loop"...
that basically runs a loop reading the content controls in the document (as you suggested)... switch to a doc change formattings, what you expect happens.
this is the code:
var cont = 0;
async function traverse() {
await Word.run(async (context) => {
for (let i = 0; i < 100; i++) {
let ccs = context.document.body.contentControls;
ccs.load();
await context.sync();
console.log(cont);
cont++;
await pause(300);
}
});
}
function pause(milliseconds) {
return new Promise((resolve) => setTimeout(resolve, milliseconds));
}
please give it a try. let me know outcomes. also I recommend you to install the latest Office, can you share version number?
if the issue persists, please make sure to prepare me script lab snippet so i can investigate further with the team, in the meatime i will tag this issue as "requires more info"
thanks and again, sorry about the delay...
No, this is definitely still a problem @JuaneloJuanelo

Here is an example of the code: https://github.com/deltreey/example-officejs-broken
This is most definitely reproducible.
hello @deltreey did you tried to repro the issue with the snippet i sent you? do yo have a script lab snippet that repros the issue?
The snippet you provided did not reproduce the issue. I created a github repository with the full solution for you. See the link above.
also, my gif provides the code for context
yes and i think its effectively the same code (its constantly scanning the document for the content control collection)
I am downloading your solution now, i am trying to scope the issue maybe this only happens when you are debugging a solution. Btw it will be preferable to have a script lab snippet reproing that way is easier to share among the folks who are investigating this....
the key difference is the getOoxml() call. I don't know how to use scriptlab but I will look into it.
also, this is occuring in production for us. it is certainly not a debugger issue.
no worries i am restoring your script there... thanks just stay tuned :) i can repro when debugging in VS
ok i have a repro! scriptlab https://gist.github.com/JuaneloJuanelo/14ea55f09f80021aa29dfffd1ee7565f
we are investigating now, it seems is the OOMXL... tHANKS!!!!
tracking as a bug with code 3382332
any word on progress here?
This issue is now fixed. (Builds 16.0.12002.10000+)
Most helpful comment
No, this is definitely still a problem @JuaneloJuanelo

Here is an example of the code: https://github.com/deltreey/example-officejs-broken
This is most definitely reproducible.