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
683 stars 95 forks source link

Task pane reopening unexpectedly when using `SupportsNoItemContext` #4789

Open ShayneMn opened 2 months ago

ShayneMn commented 2 months ago

Currently my task pane add-in closes when opening a message/reply from the same conversation. I want the add-in to remain open when the message is part of the same conversation. I haven't found a solution to this problem and decided to try using the SupportsNoItemContext feature to keep my task pane open. Then, I attempted to close the task pane using Office.context.ui.closeContainer() when the Office.context.mailbox.item.conversationId between Items changes. Whenever I call closeContainer(), the task pane closes as intended. However, when I click into another email, the task pane reopens without clicking the add-in in the ribbon. I'm not sure if this behaviour is intentional or not.

Environment

Expected behaviour

When using SupportsNoItemContext, I expect the task pane to close when Office.context.ui.closeContainer() is called and not reopen when another email is opened.

Current behaviour

When using SupportsNoItemContext, when Office.context.ui.closeContainer() is called the task pane closes but reopens when another email is opened.

sivachandran-msft commented 2 months ago

Hi @ShayneMn , Thanks for reaching out. As per your explanation, if you enable "SupportsNoItemContext" in your manifest, it automatically makes that addin a Pinnable addin as per this documentation. Refer section "Support for the item multi-select and pinnable task pane features". This could be the reason for taskpane getting displayed whenever you change the item.

ShayneMn commented 2 months ago

I am aware that SupportsNoItemContext makes my task pane pinnable, which is the reason I am using it. My point is that if I call the function Office.context.ui.closeContainer() to close the task pane it will close, but it reopens automatically when I open another email.

According to the documentation, if I call closeContainer() from my task pane it should close and unpin the task pane but that doesn't seem to be the case when using SupportsNoItemContext

anjalitp commented 2 months ago

@ShayneMn Thanks for reporting this issue regarding closeContainer() API. It has been put on our backlog. We unfortunately have no timelines to share at this point

Internal tracking ID: 4844209