gemini.google.com - Copy does not work from prompt editing area to prompt input area
Categories
(Web Compatibility :: Site Reports, defect, P2)
Tracking
(Webcompat Priority:P2, Webcompat Score:3, firefox146 verified)
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | verified |
People
(Reporter: sefeng211, Assigned: edgar)
References
(Depends on 2 open bugs, )
Details
(Keywords: webcompat:platform-bug, webcompat:site-report, webcompat:sitepatch-applied, Whiteboard: [webcompat-source:web-bugs][webcompat:sightline][webcompat:japan])
User Story
platform:windows,mac,linux impact:feature-broken configuration:general affects:all branch:release diagnosis-team:dom user-impact-score:45
Attachments
(7 files, 1 obsolete file)
|
1.55 KB,
text/html
|
Details | |
|
958 bytes,
text/html
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
25.65 KB,
text/plain
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
This is very similar to bug 1945434, but about pasting it into a different location.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1945434#c13
| Reporter | ||
Updated•8 months ago
|
| Reporter | ||
Comment 1•8 months ago
|
||
I think the issue is, Gemini does something like this in their "copy" event listener,
clipboardData.setData('text/html', '');
clipboardData.setData('text/plain', window.getSelection().toString());
And in their "paste" event listener, they do something like
if (event.clipboardData.types.includes("text/html")) {
// Use clipboardData.getData('text/html')
} else {
// Use clipboardData.getData('text/plain');
}
clipboardData.setData('text/html', ''); still creates an entry to the clipboard in Firefox, and it doesn't in Chrome.
| Reporter | ||
Comment 2•8 months ago
|
||
Edgar, masayuki, thoughts about this? Is this our issue/Chrome issue/something undefined?
| Assignee | ||
Comment 3•8 months ago
|
||
Safari also still creates an entry on the clipboard for an empty sting.
And spec doesn't specify that items with an empty string as data should be ignored. So I think it is a Chrome issue.
| Assignee | ||
Comment 4•8 months ago
|
||
There's an old Chrome issue: https://issues.chromium.org/issues/40701751. Perhaps it has regressed again.
| Reporter | ||
Comment 5•8 months ago
|
||
It looks like Webkit creates an entry but with empty content, whereas in Firefox it is the meta tag <meta http-equiv="content-type" content="text/html; charset=utf-8">
I wonder if the above differences cause it to work in Safari but not in Firefox.
I also confirmed in a local build of Firefox such that this issue is fixed if I force Gecko to not generating that entry.
| Assignee | ||
Comment 6•8 months ago
|
||
(In reply to Sean Feng [:sefeng] from comment #5)
It looks like Webkit creates an entry but with empty content, whereas in Firefox it is the meta tag
<meta http-equiv="content-type" content="text/html; charset=utf-8">I wonder if the above differences cause it to work in Safari but not in Firefox.
Yes, the content is different, I will check.
| Assignee | ||
Comment 7•8 months ago
•
|
||
Okay, although the content in system clipboard is different, but Gecko still returns an empty string for getData('text/html');, so it looks like the widget code is handling the conversion. From the Web API point of view, our behavior is actually the same as Safari’s on macOS.
I debugged the page a bit and found that it doesn’t handle the paste event directly, but instead lets the browser handle the paste action.
So I suspect the difference is from the Editor which perhaps our Editor always use the HTML data even if it is empty string, I will do more investigation.
Edited: Returning an empty string for getData('text/html') is macOS-only behavior, other platforms return whatever data is currently in the system clipboard.
Updated•8 months ago
|
| Comment hidden (obsolete) |
| Assignee | ||
Comment 9•8 months ago
|
||
| Assignee | ||
Comment 10•8 months ago
|
||
I need to check the behavior on other platforms as well.
| Assignee | ||
Comment 11•8 months ago
•
|
||
(In reply to Edgar Chen [:edgar] from comment #7)
Okay, although the content in system clipboard is different, but Gecko still returns an empty string for
getData('text/html');, so it looks like the widget code is handling the conversion. From the Web API point of view, our behavior is actually the same as Safari’s.
Oh, this is macOS-only behavior, since only macOS uses the data from clipboard cache; other platforms return whatever data is currently in the system clipboard.
So there are two things here,
1). We always wrap string with HTML tags for HTML type when copying, even if the string is empty.
2). Other browser's editors fall back to using text/plain data if text/html is an empty string.
| Assignee | ||
Updated•8 months ago
|
| Reporter | ||
Comment 12•8 months ago
|
||
Thanks Edgar!
Sounds like you are going to making a change, I'll conclude this as platform-bug then. Let me know if you disagree!
Comment 13•8 months ago
|
||
Are there any possible workarounds while waiting for a platform-bug fix to ride to release (even if uplifted that will take ~1 month)?
Updated•8 months ago
|
| Assignee | ||
Comment 14•8 months ago
|
||
One possible workaround is to add a JS intervention that calls clearData('text/html') on event.clipboardData to remove text/html data when it’s an empty string during copy.
| Reporter | ||
Updated•8 months ago
|
Updated•8 months ago
|
Comment 15•8 months ago
|
||
Comment 16•8 months ago
|
||
This doesn't seem to affect Fenix. I can copy-paste just fine there from my earlier prompts to the new-prompt input (but not on desktop). I've added Sean's suggested intervention to the bug for desktop.
| Reporter | ||
Comment 17•8 months ago
|
||
(It was Edgar suggested the intervention :) )
| Assignee | ||
Updated•8 months ago
|
Comment 18•8 months ago
|
||
Comment 19•8 months ago
|
||
| bugherder | ||
Updated•8 months ago
|
Updated•8 months ago
|
Comment 20•7 months ago
|
||
Comment 21•7 months ago
|
||
Hey guys - wanted to let you guys know that currently pasting on gemini.google.com does not work at all.
I (In reply to Yuval Meshorer from comment #20)
Hey guys - wanted to let you guys know that currently pasting on
gemini.google.com does not work at all.I
(In reply to Yuval Meshorer from comment #20)
Hey guys - wanted to let you guys know that currently pasting on
gemini.google.com does not work at all.If I go to
about:compatand remove the intervention of "Bug 1967510", then pasting works again.
Comment 22•7 months ago
|
||
Sorry, I'm new to the forums here and didn't know that uploading an attachment also means sending the comment. And also that you can't update your own comments :)
In short, the current issue is that it seems that the intervention done in https://github.com/mozilla-firefox/firefox/commit/3ebe23ad6824 currently breaks pasting on https://gemini.google.com rather than fixing it.
To prove this, I went to about:compat and disabled the compatibility for gemini.google.com and now pasting seems to work as intended.
I am on version 141.0a1, as seen in the badly pasted 'Troubleshooting information' in one of my previous comments.
Comment 23•7 months ago
|
||
I attempted to open a pull request to fix this issue from the commit here: https://github.com/mozilla-firefox/firefox/commit/3a757622f8af107712ae58a6eb1484a17901ef9c
If anyone is interested in continuing this, please feel free :)
| Assignee | ||
Comment 24•7 months ago
|
||
(In reply to Yuval Meshorer from comment #21)
Hey guys - wanted to let you guys know that currently pasting on gemini.google.com does not work at all.
I could not reproduce it, pasting on gemini.google.com works on my side.
I also didn't found any suspicious from the information you provided in comment #20.
Could you share some more information?
- Where did you copy the data from? (same web page, another web page or another application)
- Where did you paste the clipboard content to? (I guess you paste the content to the prompt input area?)
- It would be helpful if you can help to capture some log,
- Open
about:logging - Set log modules to
timestamp,sync,Clipboard:5,WidgetClipboard:5. - Start logging.
- (reproduce the issue)
- Stop logging, which will open profiler in a new tab.
- Upload local profile.
- And then share the link to us.
- Open
Comment 25•7 months ago
|
||
(In reply to Edgar Chen [:edgar] from comment #24)
Hi, sorry for the late reply.
I have looked into this yesterday a bit more and here are my findings:
- I have noticed that gemini.google.com now works with or without this intervention, thus making it obsolete.
- I am developing a Firefox extension that "holds" certain events then re-triggers them manually. For example, I "catch" a paste event and then call
.setDatamanually on it. This triggers the error of:
TypeError: 'setData' called on an object that does not implement interface DataTransfer.
- To answer your questions about the paste itself, it was to the prompt area (the textbox), and the data pasted is just plain text (so I think the source does not matter here?).
- Reproduced with logs: https://share.firefox.dev/3TvvCyC
It seems like the main issue this change now causes is that Firefox extensions cannot call wrappedJSObject.DataTransfer.setData. Here's a link to a script to reproduce this error: https://pastebin.com/3QSPsBN7 (dump this anywhere in your extension). This will cause pastes to not work.
Note that this works correctly when you disable the gemini.google.com compatibility.
If there is any more information I can provide, please reach out.
And if you want me to file a proper bug report, I will happily do that as well.
Thank you very much for your time!
| Assignee | ||
Comment 26•7 months ago
|
||
(In reply to Yuval Meshorer from comment #25)
And if you want me to file a proper bug report, I will happily do that as well.
Yes, please file a separated bug, we could continue discussion there. Thanks!
Comment 27•7 months ago
|
||
(In reply to Edgar Chen [:edgar] from comment #26)
Yes, please file a separated bug, we could continue discussion there. Thanks!
Opened https://webcompat.com/issues/162351 :)
Although this was created on a different site (this can be fine, I'm new here :)
Comment 28•7 months ago
|
||
Thanks, Yuval! I'll make a patch to remove the Gemini intervention, and will keep an eye out in the future to not let that kind of bug slip through in future interventions.
Comment 29•7 months ago
|
||
Updated•7 months ago
|
| Assignee | ||
Comment 30•7 months ago
|
||
The STR for this bug, where the clipboard data is copied from the prompt editing area, still doesn't work for me without the intervention. Perhaps we should make the extension use case work instead?
Updated•7 months ago
|
Comment 32•7 months ago
|
||
Updated•7 months ago
|
Comment 33•7 months ago
|
||
Comment 34•7 months ago
|
||
@twisniewski thank you very much!
When is this expected to hit Nightly? I'm guessing tomorrow (hence the name)? :)
If so, I'll update tomorrow as to if it works for me or not.
Comment 35•7 months ago
|
||
@Yuval, hopefully it will land within the next twelve hours, and make it into tomorrow's nightly, yes. It might take a little longer if there's an unexpected delay, but you'll see the version number of the webcompat addon (easiest to see in about:support) change form 141.2.0 to 141.3.0 once the update is active.
Comment 36•7 months ago
|
||
| bugherder | ||
Comment 37•7 months ago
|
||
Hi @twisniewski, just wanted to say that your solution works!
Validated now with the browser extension. Thank you very very much! Have a fantastic weekend.
Comment 38•7 months ago
|
||
You too, thanks Yuval!
Comment 39•7 months ago
|
||
Comment 40•7 months ago
|
||
Comment 41•7 months ago
|
||
| bugherder | ||
Updated•4 months ago
|
Updated•4 months ago
|
Comment 42•3 months ago
|
||
It looks like they have fixed the bug, so we can remove our intervention \o/
Comment 43•3 months ago
|
||
Comment 44•3 months ago
|
||
Comment 45•3 months ago
|
||
| bugherder | ||
Comment 46•2 months ago
|
||
Verified as FIXED using the RC Build
Tested with:
Browser / Version: Firefox 146.0-candidate build 1
Operating System: Windows 10 PRO x64
Updated•2 months ago
|
Description
•