Case ce-0008-selection-collapses-on-click-outside · Scenario scenario-selection-collapse-on-blur

Selection collapses unexpectedly when clicking outside contenteditable

OS: macOS Ubuntu 22.04 Device: Laptop Any Browser: Safari 120.0 Keyboard: US Status: draft
selection caret

Phenomenon

When a range of text is selected inside a contenteditable element, clicking outside the element collapses the selection to a caret position inside the editable region instead of clearing the selection entirely.

Reproduction example

  1. Focus the editable area.
  2. Type a few words across multiple lines.
  3. Drag to select part of a line or multiple lines.
  4. Click outside the editable area, for example on the page background.

Observed behavior

  • The selection collapses to a single caret position inside the editable element.
  • The range is not cleared, which can cause confusion for users relying on visual feedback.

Expected behavior

  • The selection is cleared entirely when the element loses focus, or at least behaves similarly to native text fields in the same browser and OS combination.

Notes

  • This behavior can affect keyboard shortcuts (for example, copy or delete) if they are bound to the selection state.
Before
Hello World Test
Text selected (World highlighted)
After Click Outside (Bug)
Hello World| Test
When clicking outside, selection not fully cleared but collapsed to cursor
vs
✅ Expected
Hello World Test
Expected: When clicking outside, selection fully cleared

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: macOS Ubuntu 22.04
Device: Laptop Any
Browser: Safari 120.0
Keyboard: US
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.

Comments & Discussion

Have questions, suggestions, or want to share your experience? Join the discussion below.