Page MenuHomePhabricator

Incorrect handling of URL copied from Microsoft Edge address bar
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Alternative replication:

What happens?:
The title of the web page "Example Domain" (without hyperlink) is pasted

What should have happened instead?:
The URL "https://example.com/" is pasted

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Note: such problem does not exist in Firefox or Chrome address bar

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

It's because Edge tries to be cute and copies the link as rich text (i.e. "Example Domain"), and VisualEditor rejects external links in pasted text, except on a few wikis configured otherwise (T129546).

Note there are no problem when pasting to normal WikiEditor.

@Bugreporter Yeah, it's because pasting into a plain textarea doesn't allow it to try pasting the rich-text variants.

Anyway, doesn't just apply to 2017 Wikitext Editor -- pasting it into VE also pastes the title of the page.

Having looked at it in Edge, in the clipboard event's data there's text/html, text/plain (empty string), and text/link-preview (JSON string with a perhaps-helpful url key). The existence of that last one seems like something we could easily special-case sniffing for and extracting the value from, if we want to...

Change #1143196 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[VisualEditor/VisualEditor@master] Support pasting URLs from Microsoft Edge address bar

https://gerrit.wikimedia.org/r/1143196

Change #1143196 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] Support pasting URLs from Microsoft Edge address bar

https://gerrit.wikimedia.org/r/1143196

Change #1154911 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (91ba9e148)

https://gerrit.wikimedia.org/r/1154911

Change #1154911 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (91ba9e148)

https://gerrit.wikimedia.org/r/1154911

Reopen. It seems broken again.

  • Copy an external URL from Edge 142 address bar to DiscussionTools in Edge 142 will pastes [https://example.com/ Example Domain]
  • Copy an external URL from Edge 142 address bar to DiscussionTools in Firefox 145 will pastes Example Domain
  • Copy an Wikimedia URL from Edge 142 address bar to DiscussionTools in Edge 142 will pastes [[metawiki:Main_Page|Main Page - Meta-Wiki]]
  • Copy an Wikimedia URL from Edge 142 address bar to DiscussionTools in Firefox 145 will pastes Main Page - Meta-Wiki

None of behaviors are intended.

The behaviour inside Edge should be working as intended (gerrit #1143196 parses the url and title). Inter-browser pasting to Firefox probably needs some investigation on the format. I suppose Edge's MIME type text/link-preview is lost, so the link is treated as normal HTML and dropped.

The behaviour inside Edge should be working as intended (gerrit #1143196 parses the url and title)

But (1) this is still different from how we handle copying URL from address bars in other browser. (2) This transforms Wikimedia internal URLs to internal links (see example 3) which is not explicitly ask for (remember we are editing source code and I expect none of transforms should be performed in copy-paste).

  • Copy an external URL from Edge 142 address bar to DiscussionTools in Edge 142 will pastes [https://example.com/ Example Domain]
  • Copy an Wikimedia URL from Edge 142 address bar to DiscussionTools in Edge 142 will pastes [[metawiki:Main_Page|Main Page - Meta-Wiki]]

The behaviour inside Edge should be working as intended (gerrit #1143196 parses the url and title).

But (1) this is still different from how we handle copying URL from address bars in other browser. (2) This transforms Wikimedia internal URLs to internal links (see example 3) which is not explicitly ask for (remember we are editing source code and I expect none of transforms should be performed in copy-paste).

I agree with @Bewfip that this is the expected behavior in visual mode. Yes, it is different from other browsers, but this is how Edge wants copy-pasting from the address bar to work. If you copy paste from the Edge address bar into Microsoft Word or Google Docs or something, it will also paste in the same format. If you don't like this behavior, I found a setting in Edge to disable it: SettingsAppearanceBrowser behavior and featuresChange URL copy and paste formatPlain text.

In source mode, though, I agree with @Bugreporter that this is weird. We should probably paste just the plain link. There is some precedent for this: when pasting a URL pointing to a page on the same wiki, in visual mode we generate a nice internal link, but in source mode we paste the URL as-is. I'll propose another patch for this.

  • Copy an external URL from Edge 142 address bar to DiscussionTools in Firefox 145 will pastes Example Domain
  • Copy an Wikimedia URL from Edge 142 address bar to DiscussionTools in Firefox 145 will pastes Main Page - Meta-Wiki

Inter-browser pasting to Firefox probably needs some investigation on the format. I suppose Edge's MIME type text/link-preview is lost, so the link is treated as normal HTML and dropped.

Firefox doesn't seem to expose this format in the clipboard that it makes available to VisualEditor or other websites (you can also test this on e.g. https://evercoder.github.io/clipboard-inspector/). Maybe you could file a feature request upstream.

That said, I can't reproduce this problem: it pastes an external/internal link for me. I don't know why you get a different behavior, but I don't think we can do anything about this, and I don't think it's a practical use case anyway.


For what it's worth, here's what I see on https://evercoder.github.io/clipboard-inspector/ when I copy from the Edge address bar into the page with Ctrl+V, using Edge:

image.png (794×1 px, 80 KB)

…and using Firefox:
image.png (507×1 px, 36 KB)

Edge-to-Firefox copying exposes two items in clipboard inspector, one is text/plain for URL, another is text/html, whose content is:

<html>
<body>
<!--StartFragment--><a href="xxx">yyy</a>
<!--EndFragment-->
</body>
</html>

This is a Windows-specific clipboard format.

The MIME type text/link-preview seems to be supported only by MS Edge, and is lost when copying from Edge to Chrome or Firefox (though that json is viewable with the InsideClipboard util, registered as "Link Preview Format").

I consider it unlikely that other browsers will support this format. It is not registered with IANA, and does not have a published specification. On the other hand, the CF_HTML sample shown in the previous comment is documented: https://learn.microsoft.com/en-us/windows/win32/dataxchg/html-clipboard-format

Change #1212188 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[VisualEditor/VisualEditor@master] tests: ClipboardHandler: Allow testing formats other than text/html and text/plain

https://gerrit.wikimedia.org/r/1212188

Change #1212189 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Paste URLs from Microsoft Edge address bar as plain text in source mode

https://gerrit.wikimedia.org/r/1212189

Change #1212188 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] tests: ClipboardHandler: Allow testing formats other than text/html and text/plain

https://gerrit.wikimedia.org/r/1212188

Change #1213434 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (eca5d859a)

https://gerrit.wikimedia.org/r/1213434

Change #1213434 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (eca5d859a)

https://gerrit.wikimedia.org/r/1213434

Change #1212189 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Paste URLs from Microsoft Edge address bar as plain text in source mode

https://gerrit.wikimedia.org/r/1212189

The behavior in source mode should be okay now as well.