File tree 1 file changed +6
-4
lines changed
packages/@react-aria/interactions/src
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,9 @@ export function disableTextSelection(target?: Element) {
46
46
} else if ( target instanceof HTMLElement || target instanceof SVGElement ) {
47
47
// If not iOS, store the target's original user-select and change to user-select: none
48
48
// Ignore state since it doesn't apply for non iOS
49
- modifiedElementMap . set ( target , target . style . userSelect ) ;
50
- target . style . userSelect = 'none' ;
49
+ let property = 'userSelect' in target . style ? 'userSelect' : 'webkitUserSelect' ;
50
+ modifiedElementMap . set ( target , target . style [ property ] ) ;
51
+ target . style [ property ] = 'none' ;
51
52
}
52
53
}
53
54
@@ -85,9 +86,10 @@ export function restoreTextSelection(target?: Element) {
85
86
// Ignore state since it doesn't apply for non iOS
86
87
if ( target && modifiedElementMap . has ( target ) ) {
87
88
let targetOldUserSelect = modifiedElementMap . get ( target ) as string ;
89
+ let property = 'userSelect' in target . style ? 'userSelect' : 'webkitUserSelect' ;
88
90
89
- if ( target . style . userSelect === 'none' ) {
90
- target . style . userSelect = targetOldUserSelect ;
91
+ if ( target . style [ property ] === 'none' ) {
92
+ target . style [ property ] = targetOldUserSelect ;
91
93
}
92
94
93
95
if ( target . getAttribute ( 'style' ) === '' ) {
You can’t perform that action at this time.
0 commit comments