Set selection AND focus back to document after action in MS-Word web-addin pane
in our Word web-addin, a user can click a button to apply a style in the activedocument.
Before the user can continue typing, he must first click in the document.
it would be great if we can call a method in the Javascript API to put the focus back to the document window after clicking a button in the addin
7 Comments
- Mawa1976Brass Contributor
It seems this has been honoured:
await Word.run(async (context) => {
if (Office.context.requirements.isSetSupported("WordApiDesktop", "1.4")) {
context.document.activeWindow.setFocus();
}
);
- teoddroiddCopper Contributor
Thank you, that's a great start! But that's only half the story, as it only works on Word Desktop. Word Online doesn't support this yet.
Our add-in works on both Desktop and Web, so we cannot deliver a feature that only works in one environment. For us, not having it in both is equal to not having it at all, and I'm sure this is the case for most add-ins out there.
So no, it's not honored, not yet at least, but it's a start. Looking forward to seeing it on web too!
- teoddroiddCopper Contributor
Same here, it would be a great UX improvement for our add-in.
- yolen1234Copper Contributor
This is a major issue for our (Word) add-in customers. They are experienced Word users that use Word throughout their work day. Without this capability they have to grab the mouse and click to continue working many, many times a day. Please see the Github issue hee for more details and history: https://github.com/OfficeDev/office-js/issues/316#issuecomment-3131963751
- nlidBrass Contributor
I am also encountering this issue in Word. A function in the API that lets us shift focus back to the Office application is a must have in terms of UX
- eskaarupCopper Contributor
This is a major problem from a UX perspective - we need this to work...
- jba33Copper Contributor
Same for Excel too.