File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
packages/@react-aria/interactions/src Expand file tree Collapse file tree 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) {
4646 } else if ( target instanceof HTMLElement || target instanceof SVGElement ) {
4747 // If not iOS, store the target's original user-select and change to user-select: none
4848 // 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' ;
5152 }
5253}
5354
@@ -85,9 +86,10 @@ export function restoreTextSelection(target?: Element) {
8586 // Ignore state since it doesn't apply for non iOS
8687 if ( target && modifiedElementMap . has ( target ) ) {
8788 let targetOldUserSelect = modifiedElementMap . get ( target ) as string ;
89+ let property = 'userSelect' in target . style ? 'userSelect' : 'webkitUserSelect' ;
8890
89- if ( target . style . userSelect === 'none' ) {
90- target . style . userSelect = targetOldUserSelect ;
91+ if ( target . style [ property ] === 'none' ) {
92+ target . style [ property ] = targetOldUserSelect ;
9193 }
9294
9395 if ( target . getAttribute ( 'style' ) === '' ) {
You can’t perform that action at this time.
0 commit comments