Bug 244780

Summary: Position styles cause empty range selection highlighting to appear between nodes
Product: WebKit Reporter: John Flockton <j.r.flockton.work>
Component: HTML EditingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Minor CC: j.r.flockton.work, karlcow, megan_gardner, rniwa, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 15   
Hardware: Mac (Apple Silicon)   
OS: macOS 12   
Attachments:
Description Flags
Minimal reproducible example
none
Screenshot
none
rendering in Safari, Safari TP, firefox, chrome none

Description John Flockton 2022-09-04 12:24:57 PDT
Created attachment 462125 [details]
Minimal reproducible example

This was originally reported in a separate OSS issue report for our Rich Text Editor: https://github.com/facebook/lexical/issues/2797.

In the attached minimal reproducible example index.html, the issue should be immediately visible.

Repro steps:

1. Open the attached index.html in Safari 15.
2. Observe that the range selection highlighting is visible between both paragraph elements.
3. Remove the "position: relative" styling from both paragraphs on line 10.
4. Reload the page.
5. Observe that the range selection highlighting is no longer visible.

Even though the DOM range selection is uncollapsed, I would expect it to appear collapsed (regardless of whether or not a "position" style is defined on the nodes) as the anchorNode offset is the length of the anchorNode, and the focusNode has an offset of 0. This is the case on Chromium and Firefox.

Let me know if you need any more information.

Version info:
MacOS 12.5.1
Safari 15.6.1 (17613.3.9.1.16)
Comment 1 John Flockton 2022-09-04 12:40:28 PDT
Created attachment 462129 [details]
Screenshot
Comment 2 Karl Dubost 2022-09-04 22:29:04 PDT
Created attachment 462137 [details]
rendering in Safari, Safari TP, firefox, chrome

Tested on macOS 13.0
---
Safari                     16.1          18614.2.1.1.1
Safari Technology Preview  16.0          18615.1.2.3
Firefox Nightly            106.0a1       10622.9.1
Google Chrome Canary       107.0.5280.0  5280.0
Comment 3 Radar WebKit Bug Importer 2022-09-04 22:30:07 PDT
<rdar://problem/99557958>