Cas ce-0008 · Scénario scenario-selection-collapse-on-blur

Selection collapses unexpectedly when clicking outside contenteditable

OS: macOS Ubuntu 22.04 Appareil: Laptop Any Navigateur: Safari 120.0 Clavier: US Brouillon
selectioncaret

Cette page n'a pas encore été traduite

Le contenu original en anglais est actuellement affiché. Nous apprécierions votre contribution à la traduction.

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.

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

Use this editable area to reproduce the described case.

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.