Meet Selection.getComposedRanges() ๐
Unlike getRangeAt(), it returns selection ranges across Shadow DOM boundaries, essential for modern web components.
Since August 2025, this feature is Baseline.
Learn how it works ๐
https://developer.mozilla.org/en-US/docs/Web/API/Selection/getComposedRanges
