OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
682 stars 95 forks source link

Closing a dialog is not triggering an event on Mac anymore #161

Closed barisbikmaz closed 6 years ago

barisbikmaz commented 6 years ago

Expected Behavior

When I close the office.js dialog on Mac, I can do further actions because I get the Office.EventType.DialogEventReceived event.

Current Behavior

When I close the dialog with the x close button of the dialog window or using dialog.close() the DialogEventReceived is not triggered.

Also when I open and close a dialog and when I try to open a dialog again an error is throw which says that a dialog is still active although there is no open dialog.

Steps to Reproduce, or Live Example

  1. Call the openDialog() function
  2. Close the dialog using closeDialog() or just by clicking the dialog close button on top
  3. Observe the "Dialog was closed" text is never written
var dialog;

function openDialog() {
  Office.context.ui.displayDialogAsync('https://myDomain/myDialog.html', {height: 30, width: 20},
    function (asyncResult) {
        dialog = asyncResult.value;
        dialog.addEventHandler(Office.EventType.DialogEventReceived, handleDialogEvent);
    }
  );
}

function closeDialog() {
  dialog.close()
}

function handleDialogEvent(arg) {
    console.log("Dialog was closed")
}

Context

Your Environment

barisbikmaz commented 6 years ago

Seems to work again with 16.14.