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

Text stuck in status bar after call add-in command from ribbon button #2877

Closed Biktop closed 8 months ago

Biktop commented 2 years ago

Your Environment

Current behavior

I use Office-Add-in-samples and slightly modified the source code in commands.js

async function btnOpenTaskpane(event) {
 console.log("Open task pane button pressed");
 // Your code goes here
 await SetRuntimeVisibleHelper(true);
 g.state.isTaskpaneOpen = true;
 updateRibbon();
 event.completed();
}

So now Office.addin.showAsTaskpane() is called synchronously before event.completed() that leads to strange behaviour when the text in the status bar always displays Contoso Data Importer is working on your Open task pane and it continues to display even after pressing any other buttons in the ribbon. With the original code it works correctly. Also it works in Office on the web.

Screenshot 2022-09-30 at 04 49 42

ghost commented 2 years ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

gingerjia commented 2 years ago

@madhavagrawal17 could you help to take a look at it seems it's shared runtime related? Thanks very much!

madhavagrawal17 commented 2 years ago

Thanks for reporting this issue. I tried to reproduce the problem locally, but it seems it is not SharedRuntime-related. The appropriate team is working on this issue. We will provide an update once we find the root cause of this issue.

wh1t3cAt1k commented 1 year ago

Dear Microsoft team, is there any news on this issue? It's been 4 months since the last update, and to the best of our knowledge, the issue still replicates on both the PC desktop and Mac. This negatively impacts the user perception of the add-in for ribbon-oriented user interfaces.

wh1t3cAt1k commented 1 year ago

@Wenjun-Gong @RuizhiSunMS I would like to follow up on this again...

For now, when user initiates any operation from the Ribbon, because the message in the status bar gets "stuck", the user may mistakenly think that the add-in has frozen working on an operation.

We have to pop a side panel with operation progress messages, which is suboptimal UX. (and the stuck status bar is misleading anyway). We would like to avoid having to pop the side panel just for UI feedback on the operation.

pkkj commented 1 year ago

Hi wh1t3cAt1k,

If possible, you may try to call event.complete() without waiting the taskpane showing up.

Thanks.

wh1t3cAt1k commented 1 year ago

@pkkj some of our operations are long. When we call event.completed() the user loses all visual indication of what's going on because the status bar is cleared immediately.

So either we have to:

We would prefer the status bar to work properly. Opening side panel on every operation feels intrusive and unnecessary. (cc @gmichaud)

pkkj commented 1 year ago

Hi wh1t3cAt1k,

Due to there is a bug in the status bar (it's related to App Command action and showing taskpane), there is no better work around. If possible, you could put showingtakepane at the end of the action function, and call event.complete() before it.

A fix will be made to mitigate this issue but it will take some time to reach the production.

Thanks.

wh1t3cAt1k commented 1 year ago

Hi @pkkj - is this bug (https://github.com/OfficeDev/office-js/issues/3250) I filed related? You mentioned "showing taskpane".

I understand it can take some time to reach production, can you advise on the following?

Thank you.

Biktop commented 1 year ago

Hi,

I played with 16.0.16227.20212 because of #2716 and I have managed to repeat this bug again.

wh1t3cAt1k commented 1 year ago

@pkkj @Wenjun-Gong please give us an update if possible since we're forced to take poor UX workarounds due to this bug... Thanks

pkkj commented 1 year ago

This bug should have been fixed in the newest Office build.

Thanks

wh1t3cAt1k commented 1 year ago

@pkkj can you provide more detailed version information (Mac and Windows) on which the issue should be fixed?

wh1t3cAt1k commented 10 months ago

@madhavagrawal17 @JinghuiMS @zhaoliu-MSFT

This is definitely not fixed in the latest Mac OS build, it was just observed by @gmichaud:

image

Can we please revisit this bug and investigate whether there's another possibility for the text to get stuck?

Note that we call event.completed() immediately in the handler before starting any async work.

zhenhuangMSFT commented 10 months ago

Thanks for reporting this issue. Since the setup and issue repro takes some time, our response may be delayed. Thanks for your patience.

pkkj commented 9 months ago

I try this scenario again butI am not able to repro it. I also tried to call event.complete() before any async work but I am not able to hit this problem.

I have a very simple test add-in to play with this scenario: Manifest . It only has two buttons (show and hide a taskpane) and its coding pattern is very similar to the sample test add-ins. The status bar text dismiss correctly after the ui-less action completes.

wh1t3cAt1k commented 9 months ago

@pkkj what platform did you try to replicate? Mac or Windows? Our latest replication scenarios all happened on Excel Desktop for Mac.

pkkj commented 9 months ago

@wh1t3cAt1k I verify this scenario in both Win32 and Mac and didn't see this problem. If possible, you may try to sideload the test add-in mentioned in previous reply, after you read the source code. You could play with that in your environment to figure out whether the bug can repro. If the source of my test add-in is not able to demonstrate the your scenario, feel free to share a minimum code sample that can repro this bug. Thanks.