Bug 251857 - Context menu shows wrong URL and preview when mousedown changes anchor href
Summary: Context menu shows wrong URL and preview when mousedown changes anchor href
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-02-07 09:11 PST by Chris Dumez
Modified: 2023-02-07 09:12 PST (History)
4 users (show)

See Also:


Attachments
demo (448 bytes, text/html)
2023-02-07 09:12 PST, Chris Dumez
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2023-02-07 09:11:29 PST
Steps to reproduce:
1. Open the attached sample "index.html" in Safari
2. Hold down "context menu here" to open the contextual menu

Expected results: It shows the URL and preview of https://www.apple.com/

Actual results: It shows the URL and preview of https://www.webkit.org/

Note that if you copy or tap the link, you'll get https://www.apple.com/ rather than https://www.webkit.org/.

Here's the relevant HTML source:

```
<p><a href="https://www.webkit.org/">context menu here</a></p>
<script>document.querySelector("a").addEventListener("mousedown", (event) => {
    event.target.href = "https://www.apple.com/";
});</script>
```
Comment 1 Chris Dumez 2023-02-07 09:11:37 PST
<rdar://104512680>
Comment 2 Chris Dumez 2023-02-07 09:12:08 PST
Created attachment 464887 [details]
demo