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

React Excel add-in: range.insert() function moves client viewport to top of sheet #5213

Open
henry4344 opened this issue Dec 20, 2024 · 4 comments
Assignees
Labels
Area: Excel Issue related to Excel add-ins Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown

Comments

@henry4344
Copy link

henry4344 commented Dec 20, 2024

Provide required information needed to triage your issue

When running the range.insert() function on an Excel range, it jumps the client viewport to the top of the sheet.

Your Environment

  • Platform: Office desktop on Windows
  • Host: Excel
  • Office version number: V2411
  • Operating System: Windows 11

Expected behavior

Previously, this function inserted the row below without moving the user’s viewport.

Current behavior

Now, whenever the range.insert() function is called, the user viewport jumps to the top of the sheet.

Steps to reproduce

  1. yo office --taskpane --name "insert-row-test" --host Excel --js
  2. Update the insertText() function in taskpane.js with the following code:
export async function insertText() {
  try {
    await Excel.run(async (context) => {
      const range = context.workbook.getSelectedRange();
      range.insert();

      return await context.sync();
    });
  } catch (error) {
    console.error("Error: " + error);
  }
}
  1. Scroll down the sheet so the top rows are hidden.
  2. Select a cell and click the Insert Text button in the taskpane.
  3. You should see the viewport jump up.

Link to live example(s)

  1. Insert Row Bug - Viewport Moving
  2. Open Script Lab in Excel.
  3. Import the YAML file from the Gist into Script Lab by pasting the content or uploading it.
  4. Run the script, scroll down so top rows are hidden. Select a cell, and observe the viewport behaviour when button is clicked and a row is inserted.

Context

This issue disrupts the user workflow as they need to repeatedly scroll to return to their working position.
This issue appears to have been introduced in version V2411. Previously, the viewport remained stable, which allowed for a seamless user experience.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Area: Excel Issue related to Excel add-ins label Dec 20, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Dec 20, 2024
@RuizhiSunMS RuizhiSunMS added Needs: author feedback Waiting for author (creator) of Issue to provide more info Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Dec 20, 2024
@RuizhiSunMS
Copy link

Hi @henry4344, thx for reaching out here.
I did a try and found that, if call range.insert, view would go up to the top. Would you please confirm this is like what you got?

@henry4344
Copy link
Author

Hi @henry4344, thx for reaching out here. I did a try and found that, if call range.insert, view would go up to the top. Would you please confirm this is like what you got?

Hi @RuizhiSunMS yes, this is happening to me too. Previously the view did not move when calling range.insert.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Dec 20, 2024
@RuizhiSunMS
Copy link

RuizhiSunMS commented Dec 20, 2024

@henry4344, ok. Mark it as #9641720 into our backlog. I will involve our experts to investigate. Reply would be here if any update.

@RuizhiSunMS RuizhiSunMS removed the Needs: attention 👋 Waiting on Microsoft to provide feedback label Dec 20, 2024
@henry4344
Copy link
Author

@RuizhiSunMS great, thank you.

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 Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown
Projects
None yet
Development

No branches or pull requests

2 participants