Bug 258610

Summary: Clicking a link inside a contenteditable=false element sets the target of the focusin event to the contenteditable
Product: WebKit Reporter: Brian Birtles <brian>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cdumez, karlcow, mike, rniwa, webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test case none

Description Brian Birtles 2023-06-27 23:58:43 PDT
Created attachment 466839 [details]
Test case

The attached test case looks like the following:

```
<div id=div contenteditable=false tabindex=0>
  <a href="#yer">Yer</a>
</div>
<script>
div.addEventListener('focusin', (evt) => {
  console.log(evt.target);
});
</script>
```

Clicking the link in Firefox or Chrome triggers a `focusin` event with the target set to the <a> element.

In Safari 16.5 and TP, the `target` is set to the `<div>`.

Furthermore, without the `tabindex=0`, no focusin event is dispatched in Safari, although it is in Firefox and Chrome.
Comment 1 Karl Dubost 2023-06-29 00:37:03 PDT
Hey Brian, thanks for the report.
Confirmed on latest nightly, canary, stp versions of the browsers.
Comment 2 Radar WebKit Bug Importer 2023-07-04 23:59:16 PDT
<rdar://problem/111769393>