Search code examples
ms-worddialogwebkitoffice-js

Can someone confirm the following bug in Office.js on macOS (Microsoft Word)?


The following very simple code works fine on Word Online and Word 2016 on Windows 10.

It works the first time it is used on macOS and Word 2016, but then throws an error on any subsequent use...until the page is refreshed and then it works again. To reproduce:

  1. Open a dialog window using the dialogAPI
  2. Click to close the new window
  3. Click on the button that triggers the opening of the dialog window

On the second attempt no window opens on Mac.

I am on Office Insider Slow running Word for Mac Version 116.13.1 (180523). I have had this issue since a previous release of Office Insider Slow.

The error thrown is:

TypeError: undefined is not an object (evaluating 'dialog.addEventHandler')

It seems that, on a Mac, the dialog object is not closed when the dialog window is closed.

Code:

dialogUrl = dialogUrl + 'qLTI.html';

Office.context.ui.displayDialogAsync(dialogUrl, {height: 90, width: 70},
  function (asyncResult) {
    dialog = asyncResult.value;
      dialog.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
  }
);

Trying to get confirmation and also flag MSFT. Thank you.


Solution

  • This was a known issue to MSFT and was fixed in a June release.

    See https://github.com/OfficeDev/office-js/issues/197.