[Webkit-unassigned] [Bug 224570] New: Selection ranges removed whenever focus changes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Apr 14 12:39:06 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=224570

            Bug ID: 224570
           Summary: Selection ranges removed whenever focus changes
           Product: WebKit
           Version: Safari 14
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: HTML Editing
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bcronin at quip.com
                CC: wenson_hsieh at apple.com

Whenever focus leaves a contenteditable node, the `window.document`'s `Selection` object removes the `Range` that had been associated with it. For example, when focus moves from the contenteditable region to a button in https://jsfiddle.net/f2bqw1mt/3/, you can see in the console logs that the selection no longer has the range it once did.

This runs counter to expectations from the current specification: According to https://w3c.github.io/selection-api/#definition, "Once a selection is associated with a given range, it must continue to be associated with that same range until this specification requires otherwise." In particular, in https://w3c.github.io/selection-api/#user-interactions, it is stated that "The user agent must not make a selection empty if it was not already empty in response to any user actions (e.g. clicking on a non-editable region)."

For consistency with the spec and with behavior in other browsers, the selection should remain unchanged if only the `activeElement` changes. (And while it is true that the spec is labeled as a draft, but it is quite clear on this particular issue.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210414/f97f243d/attachment-0001.htm>


More information about the webkit-unassigned mailing list