File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
packages/bits-ui/src/lib/bits/utilities/text-selection-layer Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " bits-ui " : patch
3+ ---
4+
5+ fix(Multiple): ensure ` preventOverflowTextSelection ` prop is applied
Original file line number Diff line number Diff line change 1515
1616 useTextSelectionLayer ({
1717 id: box .with (() => id ),
18- preventOverflowTextSelection: box .with (() => preventOverflowTextSelection ),
1918 onPointerDown: box .with (() => onPointerDown ),
2019 onPointerUp: box .with (() => onPointerUp ),
21- enabled: box .with (() => enabled ),
20+ enabled: box .with (() => enabled && preventOverflowTextSelection ),
2221 });
2322 </script >
2423
Original file line number Diff line number Diff line change @@ -13,15 +13,17 @@ import { noop } from "$lib/internal/noop.js";
1313import { isHTMLElement } from "$lib/internal/is.js" ;
1414import { isOrContainsTarget } from "$lib/internal/elements.js" ;
1515
16- type StateProps = ReadableBoxedValues < Required < Omit < TextSelectionLayerImplProps , "children" > > > ;
16+ type TextSelectionLayerStateProps = ReadableBoxedValues <
17+ Required < Omit < TextSelectionLayerImplProps , "children" | "preventOverflowTextSelection" > >
18+ > ;
1719
1820globalThis . bitsTextSelectionLayers ??= new Map < TextSelectionLayerState , ReadableBox < boolean > > ( ) ;
1921
2022export class TextSelectionLayerState {
2123 #unsubSelectionLock = noop ;
2224 #ref = box < HTMLElement | null > ( null ) ;
2325
24- constructor ( readonly opts : StateProps ) {
26+ constructor ( readonly opts : TextSelectionLayerStateProps ) {
2527 useRefById ( {
2628 id : opts . id ,
2729 ref : this . #ref,
@@ -79,7 +81,7 @@ export class TextSelectionLayerState {
7981 } ;
8082}
8183
82- export function useTextSelectionLayer ( props : StateProps ) {
84+ export function useTextSelectionLayer ( props : TextSelectionLayerStateProps ) {
8385 return new TextSelectionLayerState ( props ) ;
8486}
8587
You can’t perform that action at this time.
0 commit comments