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

When replying or forwarding an email, calling body.setAsync resets the email body twice #4461

Open
bchen-hs-eng opened this issue May 15, 2024 · 13 comments
Assignees
Labels
Area: Outlook Issue related to Outlook add-ins Needs: author feedback Waiting for author (creator) of Issue to provide more info

Comments

@bchen-hs-eng
Copy link

bchen-hs-eng commented May 15, 2024

Provide required information needed to triage your issue

Likely related #4392

Calling body.setAsync on a reply/forward email will cause the email body to reset, interfering with entering text.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC desktop
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Office version number: 2402 (Build 17328.20282 Click-to-run)
  • Operating System: Windows 11
  • Browser (if using Office on the web): ______

Expected behavior

body.setAsync sets the email body without extra side effects

Current behavior

body.setAsync sets the email body and the email body resets twice. If the user is actively typing into the email body, the contents can be cleared/reset

Steps to reproduce

  • Open a received email and press the reply button. We see this issue on the Microsoft Viva emails.
  • Execute item.body.getAsync, and sets the same content back with item.body.setAsync

Link to live example(s)

Javascript

$("#run").on("click", run);

const timeout = 1000;

function run() {
  // Gets current email body
  Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, (result) => {
    document.getElementById("firstBody").innerHTML = escapeHtml(result.value);

    setTimeout(() => {
      // Sets the same email body
      Office.context.mailbox.item.body.setAsync(result.value, { coercionType: Office.CoercionType.Html }, (result) => {
        Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, (result) => {
          // Gets email body again after setAsync
          document.getElementById("secondBody").innerHTML = escapeHtml(result.value);
        });
      });
    }, timeout);
  });
}

function escapeHtml(html) {
  return html
    .replace(/&/g, "&")
    .replace(/</g, "&lt;")
    .replace(/>/g, "&gt;")
    .replace(/"/g, "&quot;")
    .replace(/'/g, "&#039;");
}

HTML

<div>
	<button id="run" class="ms-Button">
    <span class="ms-Button-label">Run</span>
</button>

	<p>--FIRST--</p>
	<p id="firstBody"></p>
	<br><br>
	<p>--SECOND--</p>
	<p id="secondBody"></p>
</div>

Context

  • The flicker severely interfere with a user trying to type into the reply/forward email body.
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label May 15, 2024
@exextoc exextoc added Needs: attention 👋 Waiting on Microsoft to provide feedback Area: Outlook Issue related to Outlook add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels May 15, 2024
@exextoc exextoc self-assigned this May 15, 2024
@hsptkt
Copy link

hsptkt commented May 15, 2024

Hi @exextoc, this is actively affecting our customers using Outlook for Windows, and they're reporting disruption to their workflows. Please let us know if the team is able to revert this change to mitigate user pain. Thank you

@bchen-hs-eng bchen-hs-eng changed the title When replying or forwarding an email, calling body.setAsync causes the email body to flicker twice When replying or forwarding an email, calling body.setAsync resets the email body twice May 16, 2024
@akshayta23
Copy link
Collaborator

@Oleg-O Is this something your team can help with?

@zhngx1
Copy link

zhngx1 commented May 20, 2024

@hsptkt @akshayta23 I cannot repro the issue. Do you repro it only when call body.setAsync after the body.getAsync? Can you repro with directly calling body.setAsync?

@bchen-hs-eng
Copy link
Author

@zhngx1 We can repro this using Script Lab, and the javascript/html pair in the issue description consistently. It calls body.setAsync after the body.getAsync, which emulates our real production add-in's usages.

@bchen-hs-eng
Copy link
Author

bchen-hs-eng commented May 31, 2024

@zhngx1 Any updates on this issue? Here is a recording demonstrating this issue through the provided script lab snippets:

getsetbody_flicker.mov

@hsptkt
Copy link

hsptkt commented Jun 10, 2024

@zhngx1 Could we please get an update on this issue?

@zhngx1
Copy link

zhngx1 commented Jun 11, 2024

@hsptkt , @bchen-hs-eng sorry for the delayed response. I tried it on build 17328. I can see the flickering but it does not set the body twice. Just want to confirm, is the issue about flickering or setting the body twice?

@hsptkt
Copy link

hsptkt commented Jun 14, 2024

@zhngx1 The issue here is about how the flickering is causing a frustrating user experience (interfering with the customer's ability to start typing). It seems like a side effect of the body setting as @bchen-hs-eng highlighted in the example Script Lab, but we are specifically wanting to have the flickering fixed

@zhngx1
Copy link

zhngx1 commented Jun 21, 2024

@hsptkt May I ask why do you need to get the entire body and set it back? We are trying to see if we can provide any work around or better approach for your scenario while we investigating the issue.

@zhngx1 zhngx1 added Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Jun 24, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Status: no recent activity Issue or PR is stale (no recent activity) label Jun 28, 2024
@hsptkt
Copy link

hsptkt commented Jul 31, 2024

Hi @zhngx1, this is still an issue for us. Our use case for get/setting the entire body is for grabbing & update link nodes in the body as the user is composing a message. Our expectation is one flicker instead of two flickers for the set.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Status: no recent activity Issue or PR is stale (no recent activity) label Jul 31, 2024
@zhngx1 zhngx1 reopened this Sep 9, 2024
@zhngx1
Copy link

zhngx1 commented Sep 9, 2024

@hsptkt, I am reopening this issue. Do you only repro this issue for Microsoft Viva emails? Do you repro it on new compose?

@hsptkt
Copy link

hsptkt commented Sep 9, 2024

@zhngx1 We can repro this on replies & forwards - I'm not able to reproduce this on new composes at the moment.

@zhngx1
Copy link

zhngx1 commented Sep 11, 2024

@hsptkt Does it happen on all replies and forwards? Or only when replying or forwarding Microsoft Viva emails?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Issue related to Outlook add-ins Needs: author feedback Waiting for author (creator) of Issue to provide more info
Projects
None yet
Development

No branches or pull requests

5 participants