File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 7
7
import React from 'react'
8
8
import ReactDOM from 'react-dom'
9
9
import PropTypes from 'prop-types'
10
- import raf from 'dom-helpers/util/requestAnimationFrame'
11
10
import chain from 'chain-function'
12
11
import warning from 'warning'
13
12
13
+ import raf from 'dom-helpers/util/requestAnimationFrame'
14
+ import { clearSelection } from './utils/dom-helpers'
15
+
14
16
import ReactCSSTransitionGroupChild from 'react-transition-group/CSSTransitionGroupChild'
15
17
import { transitionTimeout } from 'react-transition-group/utils/PropTypes'
16
18
import { nameShape } from './utils/PropTypes'
@@ -127,6 +129,11 @@ export default class ReactCSSTransitionReplace extends React.Component {
127
129
const keysToLeave = this . keysToLeave
128
130
this . keysToLeave = [ ]
129
131
keysToLeave . forEach ( this . performLeave )
132
+
133
+ // When the enter completes and the component switches to relative positioning the
134
+ // child often gets selected after multiple clicks (at least in Chrome). To compensate
135
+ // the current selection is cleared whenever the component updates.
136
+ clearSelection ( )
130
137
}
131
138
132
139
performAppear ( key ) {
Original file line number Diff line number Diff line change
1
+ /* global document, window */
2
+
3
+ export function clearSelection ( ) {
4
+ if ( document . selection ) {
5
+ document . selection . empty ( )
6
+ } else if ( window . getSelection ) {
7
+ window . getSelection ( ) . removeAllRanges ( )
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments