Open Bug 1640222 Opened 4 years ago Updated 26 days ago

"Paste special" is not working properly within Google doc's spreadsheet

Categories

(Core :: DOM: Selection, defect, P3)

Unspecified
All
defect

Tracking

()

Webcompat Priority P2
Tracking Status
firefox102 --- affected
firefox103 --- affected
firefox104 --- affected

People

(Reporter: clara.guerrero, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

Attachments

(5 files)

Affected versions]
Release 76.0 (64-bit)
Beta 77.0b8 (64-bit)
Firefox Nightly 78.0a1 (2020-05-21) (64-bit)

[Affected platforms]
( macOS 10.14 (Mojave))

[Steps to reproduce]

1- Launch the Firefox Browser and visit https://en.wikipedia.org/wiki/Game_of_Thrones or https://www.w3schools.com/html/html_tables.asp
2- Open https://docs.google.com/spreadsheets
3- Select any desired amount of rows from the table in step 1 and copy with cmd c
4- Paste it in the online editor from step 2 with cmd v
5- Table is pasted successfully
6- Now click on menu edit/paste special/all except borders

[Expected result]
Table should be pasted accordingly

[Actual result]
Selection pasted is not correct.

If repeating steps in chrome, the table is correctly pasted, as shown in the attachment.

Severity: -- → S3
Depends on: 1636983
Blocks: 1636028, 1636983
No longer depends on: 1636028, 1636983
Summary: Paste special is not working properly within online editor → Paste special is not working properly within Google doc's spreadsheet
Summary: Paste special is not working properly within Google doc's spreadsheet → "Paste special" is not working properly within Google doc's spreadsheet
Webcompat Priority: --- → ?

Notice that in Beta 78.0b4 (64-bit) for macOS 10.5 no option from paste special is working, not just the "all except borders" option.

See Also: → 1427426

It seems Google spreadsheets uses its own clipboard for "paste special". Note that clicking the "paste" button from the menu will ask the user to paste via pressing Cmd/Ctrl+v.

I guess "paste special" has to use the async Clipboard API, which Firefox doesn't support fully yet.

Copying from inside Google spreadsheets and pasting via "paste special" to Google spreadsheets works.

Happens on Ubuntu too.

OS: macOS → All

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

It seems Google spreadsheets uses its own clipboard for "paste special". Note that clicking the "paste" button from the menu will ask the user to paste via pressing Cmd/Ctrl+v.

I guess "paste special" has to use the async Clipboard API, which Firefox doesn't support fully yet.

Adding bug dependency for this.

Copying from inside Google spreadsheets and pasting via "paste special" to Google spreadsheets works.

Happens on Ubuntu too.

Depends on: 1619251

Setting this as WebCompat Priority P2 for now. This is somewhat annoying and Google Sheets is important, but it's probably not a P1 for us, since Google Sheets is usable and there is a workaround available.

Webcompat Priority: ? → P2

Dennis: FYI, implementing and exposing the async clipboard API, which should fix or allow Google fixing this issue, is WIP (bug 1744524 and related ones).

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

Copying from inside Google spreadsheets and pasting via "paste special" to Google spreadsheets works.

Please note that this doesn't work even if copying from google spreadsheets to other google spreadsheets. For some reason this has not been fixed by bug 1744524.
For more details, please check the latest attachment.

(In reply to Cristian Baica [:cbaica], Release Desktop QA from comment #9)

Created attachment 9283634 [details]
paste special in google docs

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

Copying from inside Google spreadsheets and pasting via "paste special" to Google spreadsheets works.

Please note that this doesn't work even if copying from google spreadsheets to other google spreadsheets. For some reason this has not been fixed by bug 1744524.
For more details, please check the latest attachment.

Fixing bug 1744524 is prerequisite for fixing this bug. However, it's not sufficient. First, bug 1770358 will have to be fixed and afterwards Google Spreadsheets might need adaptation too.

Depends on: 1770358

I could no longer reproduce this on Win11, Nightly121.

Duplicate of this bug: 1862762
See Also: → 1869308

(In reply to Hsin-Yi Tsai (she/her) [:hsinyi] from comment #11)

I could no longer reproduce this on Win11, Nightly121.

Oops, corrected - the issue is still reproducible for me.

Dear webcompat team,
clipbaord.read & readText() have been enabled in nightly and early beta. However, this issue is still there. Can you help us investigate this a bit further and potentially will have to reach out to gsuite team to change their code accordingly?

Flags: needinfo?(dschubert)
Flags: needinfo?(dschubert) → needinfo?(kberezina)

I've tried to use "Paste special" > "All except borders" (and other items from this submenu) in Chrome and it doesn't work unless I install the Google Docs offline extension.

Hi Hsin-Yi Tsai, wonder if you could confirm whether this is the case for you as well?

(I had the extension already installed in Chrome, so the feature worked. After uninstalling it, "Paste special" didn't work, but started working once I installed it again. So I'm trying to figure out if the extension is required and which APIs it's relying on).

Flags: needinfo?(kberezina) → needinfo?(htsai)

Hello Ksenia, good catch! I didn't realize that I have the extension installed. Similar here, "Paste special" didn't work on Chromium-based browsers if I uninstalled the extension.

Flags: needinfo?(htsai)

The extension is marked as "Installed by default" in Chrome, but I don't know what the situation is with other Chromium-based browsers.

(In reply to James Graham [:jgraham] from comment #17)

The extension is marked as "Installed by default" in Chrome, but I don't know what the situation is with other Chromium-based browsers.

I was using Chrome and Edge to reproduce. Same for Edge.

(In reply to Hsin-Yi Tsai (she/her) [:hsinyi] from comment #18)

(In reply to James Graham [:jgraham] from comment #17)

The extension is marked as "Installed by default" in Chrome, but I don't know what the situation is with other Chromium-based browsers.

I was using Chrome and Edge to reproduce. Same for Edge.

That's good to know. I did some investigation last year for bug1524772 that requires the same extension. I'll install it in Firefox and see whether pasting would work right away or try to figure out what's missing.

Flags: needinfo?(kberezina)
Attached file manifest.json

GDocs is using document.execCommand('paste') when using "Paste" and "Paste special" from the top/context menu.

I've created a codepen testcase that illustrates the behaviour (pasting with execCommand doesn't work in Firefox and works in Chrome only if I install the modified google docs offline extension - more on that below)

The extension code is mostly not being used at all for this functionality, however it looks like content_capabilities + permissions from manifest.json is what makes document.execCommand('paste') work in Chrome:

  "content_capabilities": {
    "matches": [
      "https://docs.google.com/*",
      "https://drive.google.com/*",
      "https://drive-autopush.corp.google.com/*",
      "https://drive-daily-0.corp.google.com/*",
      "https://drive-daily-1.corp.google.com/*",
      "https://drive-daily-2.corp.google.com/*",
      "https://drive-daily-3.corp.google.com/*",
      "https://drive-daily-4.corp.google.com/*",
      "https://drive-daily-5.corp.google.com/*",
      "https://drive-daily-6.corp.google.com/*",
      "https://drive-preprod.corp.google.com/*",
      "https://drive-staging.corp.google.com/*",
    ],
    "permissions": [ "clipboardRead", "clipboardWrite", "unlimitedStorage" ]
  },

I've attached a simple manifest.json containing content_capabilities. It makes the pasting testcase work in Chrome, (with added "https://codepen.io/" and "https://cdpn.io/" to the list of matches). It only works in non-stable channels, i.e. Chrome Canary as this property is whitelisted only to 6 verified extensions in stable channels.

I believe document.execCommand('paste') is disabled for webcontent for security reasons, but using an extension with content_capabilities and clipboardRead permissions is basically enabling it in Chrome, though only for "trusted" (likely internal Google) extensions.

Not sure what can be done on our side given that Google Docs are not using Clipboard API, but rather implementing a workaround.
I've noticed Safari is showing a native "Paste" context menu when document.execCommand('paste'); is executed, perhaps we could do something similar?

Flags: needinfo?(kberezina)
No longer depends on: 1619251
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: