Mawa1976's avatar
Mawa1976
Brass Contributor
Feb 23, 2024
Status:
New

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

  • Mawa1976's avatar
    Mawa1976
    Brass Contributor

    It seems this has been honoured:

    await Word.run(async (context) => {

      if (Office.context.requirements.isSetSupported("WordApiDesktop", "1.4")) {

          context.document.activeWindow.setFocus();

       }

    );

    • teoddroidd's avatar
      teoddroidd
      Copper 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!

  • teoddroidd's avatar
    teoddroidd
    Copper Contributor

    Same here, it would be a great UX improvement for our add-in.

  • yolen1234's avatar
    yolen1234
    Copper 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

  • nlid's avatar
    nlid
    Brass 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

  • eskaarup's avatar
    eskaarup
    Copper Contributor

    This is a major problem from a UX perspective - we need this to work...