demo · v132

The bug in practice: an inline toolbar that never appeared

A Medium-style floating toolbar shows only when the user has selected text. Custom-element rich editors usually live inside a shadow root, so before v132 Selection.isCollapsed always returned true for shadow selections — toolbars stayed hidden. Try it: select text inside the shadow editor; the toolbar appears.

Click and drag across the text below. The toolbar follows the selection only when isCollapsed is false — the exact thing that broke before v132 fixed shadow-root reporting.

shadow-DOM rich editor

This paragraph lives in the light DOM. Selecting text here always worked.

isCollapsed
toString().length
anchorNode root

see also