demo · v133

Drag-select inside a delegated-focus editor

A custom rich-editor with delegatesFocus: true wraps a real <textarea>. Drag-select a range of text. Before 133, the selection was dropped after the click delegated focus to the inner control. After 133, the selection is preserved.

drag across this text inside the editor:

selection state (poll every 250ms)

activeElement:
window.getSelection().toString(): (empty)
textarea.selectionStart..selectionEnd:

the bug, in one sentence

With delegatesFocus: true, the shadow host's first focusable child receives focus on a mouse click. Pre-133, the click event was then marked as handled — meaning the standard "begin a text selection" logic that runs afterwards never fired. So inside any custom <rich-editor> / <sl-textarea> / <ds-input> built with delegatesFocus, drag-select silently broke. Two-year-old bug, 23 stars, fixed in 133 by letting selection processing run after focus delegation.

this.attachShadow({ mode: "open", delegatesFocus: true });
// pre-133: clicking the shadow host focuses the inner textarea
//          but the click is consumed → no drag-select
// 133+:    focus still delegates, AND the selection range is honoured

see also