In the Excel add-in, immediately after closing the dialog created using displayDialogAsync, you cannot edit cells in the worksheet. If you click elsewhere outside the worksheet (ribbon, taskbar, etc.), Collapse / enlarge Excel or double-click the cell, then you can edit again. If you scroll while you cannot edit, everything in excel becomes "un-clickable".
In addition, I noticed that the title bar (where the document name is displayed) remains gray until you close the worksheet, as if Excel had no focus.
I was able to reproduce this using the basic Excel add-in template from Visual Studio:
In the manifest, I added a button to the ribbon (to open a dialog):
<Control xsi:type="Button" id="DDR.SettingsButton">
<Label resid="DDR.SettingsButton.Label" />
<Supertip>
<Title resid="DDR.SettingsButton.Title" />
<Description resid="DDR.SettingsButton.Text" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Contoso.tpicon_16x16" />
<bt:Image size="32" resid="Contoso.tpicon_32x32" />
<bt:Image size="80" resid="Contoso.tpicon_80x80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>openDialog</FunctionName>
</Action>
</Control>
Then the function to the function file:
function openDialog(event) {
Office.context.ui.displayDialogAsync(window.location.origin + "/functions/Dialog.html", { height: 50, width: 50 }, function dialogCallback(asyncResult) {
if (asyncResult.status !== "failed") {
var dialog = asyncResult.value;
dialog.addEventHandler(Office.EventType.DialogMessageReceived, function (args) {
dialog.close();
event.completed();
});
dialog.addEventHandler(Office.EventType.DialogEventReceived, function (arg) {
switch (arg.error) {
case 12006:
event.completed();
break;
default:
break;
}
});
}
});
}
Then I created a very simple dialog:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.1.min.js"></script>
<script>
Office.initialize = function () {
$('#buttonClose').click(close);
};
function close() {
Office.context.ui.messageParent("close");
}
</script>
</head>
<body>
<Button id="buttonClose">Close</Button>
</body>
</html>
I experienced a very similar behavior that was caused (now fixed) by an iframe that I embedded in the taskbar (original question here: Unable to edit cells after setSelectedDataAsync in Excel ).
Is there a workaround / fix for this?
Thanks!