Closed Bug 1722711 Opened 4 years ago Closed 3 years ago

Copy-pasting to JIRA is broken

Categories

(Web Compatibility :: Site Reports, defect)

Firefox 90
Desktop
All
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mycoolflirting, Unassigned, NeedInfo)

References

()

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

Uninstalled and reinstalled Firefox
Restarted the machine
Removed caches

Actual results:

Could not copy text from outlook, ms product on to jira when opened in firfox. Works fine with other browser

Expected results:

Should have bene copied in the first go

Severity: -- → S1
Priority: -- → P1
Component: Untriaged → DOM: Copy & Paste and Drag & Drop
Product: Firefox → Core

I feel like I have seen more copy and paste related bugs in Firefox 90 than usual. Do you think we changed something?

https://bugzilla.mozilla.org/buglist.cgi?quicksearch=%3Acopy%20days_elapsed%3C6&list_id=15786383

Flags: needinfo?(masayuki)

Well, one of the bug list, bug 1722535 points http://forums.mozillazine.org/viewtopic.php?f=38&t=3076985 and there is this comment:

Edit: So I ran Mozregression, and it narrowed down the issue to the commit for the following: Bug 1627175 - part 57: Move HTMLEditor::GetBetterInsertionPointFor() to HTMLEditUtils r=m_kato!

So, bug 1627175 might cause something, I'll check it.

Assignee: nobody → masayuki
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(masayuki)

Oh, but the Jira's popup's comment field which I can reproduce this bug is <textarea>. The change mentioned in bug 1722535 affects only in contenteditable or designMode editor. So, this must be caused by another change.

And oddly, I can paste from Outlook if I press Ctrl + v twice.

Wow, surprisingly, Jira temporarily creates HTMLEditor instance at pressing Ctrl + v, then, destroy the editor from paste event listener. Therefore, neither our HTMLEditor nor TextEditor handles paste command directly. However, doing nothing if HTMLEditor is destroyed from paste event is not new behavior. It's at least starting from 84.

I guess, Jira tries to get pasting "text/html" data with a hidden element whose contenteditable is true and temporarily inserted at keydown of Ctrl + v, then, serializes the clipboardData.getData("text/html") and inserts it into the <textarea>.

I tried to paste from simply some paragraphs or list items from composer of Outlook, I can paste them into Jira. I'm not sure which part is a problem of this bug.

Anyway, it seems that this is related to a change around serializer, not editor.

OS: Unspecified → Windows
Hardware: Unspecified → Desktop

Wait, this is not a recent regression of Firefox. I cannot reproduce this bug in ESR. However, according to mozregression, at least I can reproduce this bug with 2020-10-28's Nightly build. So, I think that this is old regression or caused by a change of Jira or Outlook.

Assignee: masayuki → nobody

I tried mozregression again after release 78, the result is only the big range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=31fb4a2a69124b6a21e5d8f44a0407d489749407&tochange=597ca7dea6877156e934d52668d4ac6e60bb0826
But it seems that there is no possible regression cause.

Aditya Tiku: Did you reproduce this bug at 89 or earlier?

Flags: needinfo?(mycoolflirting)

Maybe I stumbled over another/related STR:

  1. Have a google sheet with links (here jira tickets, but I think this is irrelevant) in a column
  2. Click on a link and then on the copy icon in the popup
  3. Go to another tab with an open jira ticket and try to paste the link - nothing appears.

If instead I double-click into the cell, select the link as text by hand and press Ctrl+C, I can paste it into jira. It might well be a combination of problems that starts in the source application (how data is put into the clipboard).

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #7)

I tried mozregression again after release 78, the result is only the big range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=31fb4a2a69124b6a21e5d8f44a0407d489749407&tochange=597ca7dea6877156e934d52668d4ac6e60bb0826
But it seems that there is no possible regression cause.

Aditya Tiku: Did you reproduce this bug at 89 or earlier?

No, only experiencing it in 90

Flags: needinfo?(mycoolflirting)

Masayuki: is this issue supposed to be fixed by bug 1722535?

Flags: needinfo?(masayuki)

No, I still reproduce this bug.

Flags: needinfo?(masayuki)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #11)

No, I still reproduce this bug.

Thanks. I'll try to find some time during the coming weeks to have a closer look at this issue.

Assignee: nobody → mbrodesser

Can't reproduce the issue on Ubuntu 20.04. Neither with Nightly nor with Release. Will give it on Windows a try.

Indeed, still reproducible on Windows with Nightly.

The following is about the scenario described in #c8.

When copying from Chrome, the clipboard is only filled with text flavors, so no HTML flavor.

When copying from Firefox, the clipboard is filled with text flavors and HTML flavors.
The text flavors contain the correct link. The HTML flavors are empty:

"HTML Format":

Version:0.9
StartHTML:00000097
EndHTML:00000167
StartFragment:00000131
EndFragment:00000131
<html><body>
<!--StartFragment--><!--EndFragment-->
</body>
</html> 

"text/html": empty.

When pasting, presumably one of the HTML flavors is chosen, that's why no content is pasted.

Summary: Copy paste in Jira will not work directly from Outlook → Copying from Outlook/Google Sheets and pasting to JIRA is broken

jstutte: do you remember if the Google Sheets scenario worked in the past?

Flags: needinfo?(jstutte)

(In reply to Mirko Brodesser (:mbrodesser) from comment #16)

jstutte: do you remember if the Google Sheets scenario worked in the past?

No, I do not remember I noticed this earlier than reported but I cannot say for sure that I've ever used it successfully before from sheets.

Flags: needinfo?(jstutte)

(In reply to Jens Stutte [:jstutte] from comment #17)

(In reply to Mirko Brodesser (:mbrodesser) from comment #16)

jstutte: do you remember if the Google Sheets scenario worked in the past?

No, I do not remember I noticed this earlier than reported but I cannot say for sure that I've ever used it successfully before from sheets.

Thanks.

Surprisingly, on Ubuntu 20.04, the "text/html" flavor also doesn't contain the copied link:

mirko@mirko-ThinkPad-X1-Carbon-6th:~ $ xclip -selection clip -o -t TARGETS
TIMESTAMP
TARGETS
MULTIPLE
SAVE_TARGETS
UTF8_STRING
COMPOUND_TEXT
TEXT
STRING
text/plain;charset=utf-8
text/plain
text/html
mirko@mirko-ThinkPad-X1-Carbon-6th:~ $ xclip -selection clip -o -t TEXT
https://mozilla-hub.atlassian.net/browse/FFXP-487mirko@mirko-ThinkPad-X1-Carbon-6th:~ $ xclip -selection clip -o -t text/html
<meta http-equiv="content-type" content="text/html; charset=utf-8">mirko@mirko-ThinkPad-X1-Carbon-6th:~ $

Therefore, it could be that on Ubuntu, when pasting, the "text/html" flavor isn't considered. IIRC, I've seen something similar for another issue with slack, but I don't remember exactly.

Therefore, it could be that on Ubuntu, when pasting, the "text/html" flavor isn't considered. IIRC, I've seen something similar for another issue with slack, but I don't remember exactly.

The comment I had in mind about the slack issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1636988#c12

(In reply to Aditya Tiku from comment #0)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

Uninstalled and reinstalled Firefox
Restarted the machine
Removed caches

Actual results:

Could not copy text from outlook, ms product on to jira when opened in firfox. Works fine with other browser

Aditya: to be sure, do you mean a web-version of Outlook or a native Windows application? If the latter, which version?

Expected results:

Should have bene copied in the first go

Flags: needinfo?(mycoolflirting)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #3)

Oh, but the Jira's popup's comment field which I can reproduce this bug is <textarea>. The change mentioned in bug 1722535 affects only in contenteditable or designMode editor. So, this must be caused by another change.

Masayuki: how exactly do you copy from Outlook (offline version, I presume) when the issue reproduces? I neither could reproduce the issue when using the copy icon, nor with CTRL+c.

Flags: needinfo?(masayuki)

(In reply to Mirko Brodesser (:mbrodesser) from comment #22)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #3)

Oh, but the Jira's popup's comment field which I can reproduce this bug is <textarea>. The change mentioned in bug 1722535 affects only in contenteditable or designMode editor. So, this must be caused by another change.

Masayuki: how exactly do you copy from Outlook (offline version, I presume) when the issue reproduces? I neither could reproduce the issue when using the copy icon, nor with CTRL+c.

I reproduce this when the copied data contains table. I tested with email for insiders. If you need the email. I'll forward it to you,

Flags: needinfo?(masayuki)

(In reply to Jens Stutte [:jstutte] from comment #8)

Maybe I stumbled over another/related STR:

  1. Have a google sheet with links (here jira tickets, but I think this is irrelevant) in a column
  2. Click on a link and then on the copy icon in the popup
  3. Go to another tab with an open jira ticket and try to paste the link - nothing appears.

If instead I double-click into the cell, select the link as text by hand and press Ctrl+C, I can paste it into jira. It might well be a combination of problems that starts in the source application (how data is put into the clipboard).

Hello! Tried reproducing the issue using the above STR on macOS 10.13, 10.15 with Firefox 93.0a1 (20210815094823) and with Firefox 92.0b4 on macOS 11.5 but with no luck...
I can reproduce this issue on Windows 10x64 tho following this STR with Firefox 93.0a1 (20210815094823) when trying to paste it inside the Jira description field. On Windows 10x64 I can reproduce bug 1636988 (Slack issue) as well but I can't on macOS 10.15. Also, I cannot reproduce the issue when copying from Outlook/Excell to Jira either on macOS or Windows 10x64. If more information is needed please let me know. Thank you!

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #23)

(In reply to Mirko Brodesser (:mbrodesser) from comment #22)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #3)

Oh, but the Jira's popup's comment field which I can reproduce this bug is <textarea>. The change mentioned in bug 1722535 affects only in contenteditable or designMode editor. So, this must be caused by another change.

Masayuki: how exactly do you copy from Outlook (offline version, I presume) when the issue reproduces? I neither could reproduce the issue when using the copy icon, nor with CTRL+c.

I reproduce this when the copied data contains table. I tested with email for insiders. If you need the email. I'll forward it to you,

Please forward it to me.

Edit: and is the presumption correct, that you're using the offline version of Outlook?

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #6)

Wait, this is not a recent regression of Firefox. I cannot reproduce this bug in ESR. However, according to mozregression, at least I can reproduce this bug with 2020-10-28's Nightly build. So, I think that this is old regression or caused by a change of Jira or Outlook.

The Google Sheets bug is reproducible with ESR, therefore the Outlook bug is presumably different from that.

Masayuki: couldn't reproduce the issue with that Email. Neither with the offline version of Outlook, nor with the web-app. With which one can you reproduce the issue? A reproduction video could be helpful.

Flags: needinfo?(masayuki)

(In reply to Mirko Brodesser (:mbrodesser) from comment #27)

Masayuki: couldn't reproduce the issue with that Email. Neither with the offline version of Outlook, nor with the web-app. With which one can you reproduce the issue? A reproduction video could be helpful.

For the record: clarified this via a different communication channel. The offline version of Outlook was used and it's apparently an older one than the one on my machine. Maybe it's fixed in the newer versions. In any case, the issue must be different from the Google Sheets issue, because for Masayuki, the clipboard was filled correctly.

Will continue the investigation of the Google Sheets issue in bug 1636988.

Summary: Copying from Outlook/Google Sheets and pasting to JIRA is broken → Copy-pasting from Outlook (native application, not the webapp) and pasting to JIRA is broken

Lowering the priority of this ticket, because it apparently doesn't affect newer versions of Outlook.

Assignee: mbrodesser → nobody
Severity: S1 → S2
Priority: P2 → --

Tried to recording, but I couldn't hide my privacy data from the video, so I give up to do it.

Instead, I debug it again, then, I see:

    function n() {
      o.remove()
    }
    var i = document.activeElement;
    e.selectionStart = e.target.selectionStart,
    e.selectionEnd = e.target.selectionEnd;
    var o = t('<div contenteditable="true" class="attach-screenshot-paste-catcher"></div>').appendTo('body');
    return o.focus(),
    t(i).is(':focusable:input,:aui-focusable:input') && setTimeout(function () {
      i.focus()
    }),
    function (t, u) {
      if (t == E) {
        if (a.isImagePasteEvent(u)) return n(),
        u.target = i,
        new L(u);
        if (a.isHtmlImagePasteEvent(u)) return n(),

this part in the paste event listener.

var s = function (t) {
    if (t.clipboardData && t.clipboardData.types && e.contains(t.clipboardData.types, 'text/html')) {
      var n = t.clipboardData.getData('text/html'),
      a = new DOMParser,
      i = a.parseFromString(n, 'text/html'),
      r = i.body.querySelectorAll('img');
      return 1 === r.length ? r[0].getAttribute('src') : null
    }
  };
  o.getHtmlImagePaste = s,
  o.isHtmlImagePasteEvent = function (t) {
    return null != s(t)
  },

t is native paste event. Then, in my case, the fragment has only one <img> whose src is not empty. Therefore, isHtmlImagePasteEvent returns false, then, the placeholder of pasting data (<div contenteditable="true" class="attach-screenshot-paste-catcher">) is removed and the pasted data is lost completely.

So, in my case, this happens only when there is an <img>. I guess that this is done against security/privacy concern. However, it's really odd that if there are two or more <img> elements, it works. And failing paste silently is anyway not user friendly. So, I think that we should contact Jira Software.

Reporter, don't you fail only when the pasting data contains an image?

Still couldn't reproduce the issue with Microsoft Outlook for Microsoft 365 MSO (16.0.13801.20840) 64-bit and JIRA.

Simplest STR is:

  1. open data:text/html,abc<img src=foo>def
  2. select all
  3. copy
  4. Open JIRA and click "Create" at top of the page
  5. Try to paste into "description" field of the in-content popup with Ctrl+V

Then, I don't see any text in the field.

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #32)

Simplest STR is:

  1. open data:text/html,abc<img src=foo>def
  2. select all
  3. copy
  4. Open JIRA and click "Create" at top of the page
  5. Try to paste into "description" field of the in-content popup with Ctrl+V

Then, I don't see any text in the field.

Great, thanks. That's reproducible even on Ubuntu 20.04. It was important to paste to the "Description" field. A "Comment" field of an existing ticket didn't reproduce the issue.

Ubuntu: Interestingly, Chrome doesn't create the "text/html" flavor on the primary clipboard:

$ xclip -o -t TARGETS
TIMESTAMP
TARGETS
SAVE_TARGETS
MULTIPLE
STRING
UTF8_STRING
TEXT
text/plain
$ xclip -o -t text/plain
abcdef

That might be reason, why the issue doesn't occur with Chrome.

Interestingly, pasting to JIRA in Firefox also doesn't work when there's no "text/html" flavor (reproducible by copying from Chrome).

Ubuntu: when copying from Chrome, the XA_CLIPBOARD contains the "text/html" flavor:

 xclip -sel clip -o -t TARGETS
TIMESTAMP
TARGETS
SAVE_TARGETS
MULTIPLE
STRING
UTF8_STRING
TEXT
text/plain
text/html
Summary: Copy-pasting from Outlook (native application, not the webapp) and pasting to JIRA is broken → Copy-pasting to JIRA is broken

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #30)

Tried to recording, but I couldn't hide my privacy data from the video, so I give up to do it.

Instead, I debug it again, then, I see:

    function n() {
      o.remove()
    }
    var i = document.activeElement;
    e.selectionStart = e.target.selectionStart,
    e.selectionEnd = e.target.selectionEnd;
    var o = t('<div contenteditable="true" class="attach-screenshot-paste-catcher"></div>').appendTo('body');
    return o.focus(),
    t(i).is(':focusable:input,:aui-focusable:input') && setTimeout(function () {
      i.focus()
    }),
    function (t, u) {
      if (t == E) {
        if (a.isImagePasteEvent(u)) return n(),
        u.target = i,
        new L(u);
        if (a.isHtmlImagePasteEvent(u)) return n(),

this part in the paste event listener.

var s = function (t) {
    if (t.clipboardData && t.clipboardData.types && e.contains(t.clipboardData.types, 'text/html')) {
      var n = t.clipboardData.getData('text/html'),
      a = new DOMParser,
      i = a.parseFromString(n, 'text/html'),
      r = i.body.querySelectorAll('img');
      return 1 === r.length ? r[0].getAttribute('src') : null
    }
  };
  o.getHtmlImagePaste = s,
  o.isHtmlImagePasteEvent = function (t) {
    return null != s(t)
  },

t is native paste event. Then, in my case, the fragment has only one <img> whose src is not empty. Therefore, isHtmlImagePasteEvent returns false, then, the placeholder of pasting data (<div contenteditable="true" class="attach-screenshot-paste-catcher">) is removed and the pasted data is lost completely.

So, in my case, this happens only when there is an <img>. I guess that this is done against security/privacy concern. However, it's really odd that if there are two or more <img> elements, it works. And failing paste silently is anyway not user friendly. So, I think that we should contact Jira Software.

I'll try to find a contact from JIRA/Atlassian. Debugging the minified JS doesn't make sense.

Reporter, don't you fail only when the pasting data contains an image?

Assignee: nobody → mbrodesser

Just added mbrodesser@mozilla.com to the Atlassian ticket

Atlassian has created a bug on their side to track:
https://jira.atlassian.com/browse/JRACLOUD-77245?error=login_required&error_description=Login+required&state=7739e9dc-796c-4443-933a-677a38714432

They asked if someone could also watch it so that if they need more feedback they could respond.

(In reply to Jennifer Hayashi [:jen] from comment #39)

Atlassian has created a bug on their side to track:
https://jira.atlassian.com/browse/JRACLOUD-77245?error=login_required&error_description=Login+required&state=7739e9dc-796c-4443-933a-677a38714432

They asked if someone could also watch it so that if they need more feedback they could respond.

I'm watching the issue and presumably Masayuki too.

awesome! thanks!

From Atlassian's corresponding JIRA issue: "[...]Our current timeline for the rollout of this feature is between Nov-Dec 2021.[...]". So we should re-test this in or after the mentioned time-frame.

Flags: needinfo?(mycoolflirting)

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #32)

Simplest STR is:

  1. open data:text/html,abc<img src=foo>def
  2. select all
  3. copy
  4. Open JIRA and click "Create" at top of the page
  5. Try to paste into "description" field of the in-content popup with Ctrl+V

Then, I don't see any text in the field.

As requested on qa-coordination slack chat, I've retested the steps in comment 32 and succeeded in reproducing the issue. It would not be pasted the first time, but if spammed a few times, the paste would eventually work. Tested with Nightly v96.0a1 on Windows 10.
NI me if the request is not complete. Thanks.

Flags: needinfo?(mbrodesser)

Bodea Daniel: thanks.

Flags: needinfo?(mbrodesser)
Severity: S2 → --
Component: DOM: Copy & Paste and Drag & Drop → Desktop
Priority: P2 → --
Product: Core → Web Compatibility
Assignee: mbrodesser → nobody

I've checked different scenarios as posted in the comments and I was able to copy data from Google Sheets/Outlook mail and paste all in Jira Pasted data on the first attempt:

  • table data / data:text/html,abc<img src=foo>def / simple text.

Tested with:
Browser / Version: Firefox Nightly 103.0a1 (2022-06-21)
Operating System: Windows 10 Pro

Aditya, Masayuki can you still reproduce it on your side?

Flags: needinfo?(mycoolflirting)
Flags: needinfo?(masayuki)

Yeah, it seems working, I tested with "Microsoft® Outlook® 2019 MSO (Version 2205 Build 16.0.15225.20028) 32bit" on Win11.

Flags: needinfo?(masayuki)

Thanks Masayuki for confirming, I'll close the issue.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.