Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excel.run() Operations Blocked While Data Validation Dropdown Is Open #4936

Open
buzzo123 opened this issue Sep 27, 2024 · 2 comments
Open
Assignees
Labels
Area: Excel Issue related to Excel add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback

Comments

@buzzo123
Copy link

buzzo123 commented Sep 27, 2024

Description:

I'm developing an Excel add-in using Office.js and I've encountered a problem when a data validation dropdown (list) is open in a cell. While the dropdown is open, all operations triggered via Excel.run() are queued and remain in a waiting state until the dropdown is closed by the user.

I would like to be able to either:

  1. Force Excel.run() operations to execute while a dropdown is open, or
  2. Detect when the dropdown is open and handle the interaction accordingly.

Currently, it seems that Excel enters a modal state while the dropdown is open, preventing any Office.js operations from executing until the interaction is finished. This causes delays in my add-in when users interact with cells that have data validation lists.

Steps to Reproduce:

  1. Create a data validation dropdown in a cell (e.g., A1) using Excel's built-in data validation.
  2. Open the dropdown in that cell.
  3. Try to run any Excel.run() operation, such as setting a value in another cell, while the dropdown is still open.

Expected Behavior:

  • I expect Excel.run() operations to execute without being blocked, even when a dropdown list is open in a cell.
  • Alternatively, I'd like to be able to detect when the dropdown is open so that I can prevent or delay the operation until the interaction is complete.

Actual Behavior:

  • Excel.run() operations remain in a waiting state until the user closes the dropdown.
  • There’s no clear way to detect that the dropdown is open and handle this in the Office.js code.

Example Code:

Excel.run(async (context) => {
    const sheet = context.workbook.worksheets.getActiveWorksheet();
    const range = sheet.getRange("A2");
    
    // Open a dropdown (user interaction required)
    // While the dropdown is open, this operation is blocked
    range.values = [["New Value"]];
    await context.sync(); // This operation waits until the dropdown is closed
});

Possible Workarounds:

I've tried some workarounds, such as retrying operations after a delay or handling onSelectionChanged events, but these are not ideal because they do not solve the issue of detecting the dropdown's modal state.

Environment:

  • Excel: Excel 365 Desktop Version 2408
  • Office.js: 1.1.91
  • Platform: Windows

Request:

  • Is it possible to provide a way to force operations to execute even when a data validation dropdown is open?
  • Alternatively, can there be a method in Office.js to detect when a dropdown is open so that add-ins can handle this scenario better?
@pinverso pinverso added the Area: Excel Issue related to Excel add-ins label Sep 30, 2024
@AlexJerabek
Copy link
Collaborator

Hi @buzzo123,

Thank you for raising this issue. I don't believe there is an API that will solve your scenario here. I'm going to transfer this issue to the product repo (office-js) so the feature crew sees this.

@AlexJerabek AlexJerabek transferred this issue from OfficeDev/Office-Add-in-samples Sep 30, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Sep 30, 2024
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Excel Issue related to Excel add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback
Projects
None yet
Development

No branches or pull requests

4 participants