Don't get selection if no active element
Fixes #694. Previously, it could be that there was an active element that was removed in between mousedown and mouseup.
Ben Alpert committed
Dec 31, 2013 at 17:25 UTC
7a9e5443b7184986e08e411d9e9ad2d7228c7827
1 file changed
+6
-2
src/eventPlugins/SelectEventPlugin.js
+6
-2
@@ -96,8 +96,12 @@ function getSelection(node) {
96
*/
97
function constructSelectEvent(nativeEvent) {
98
// Ensure we have the right element, and that the user is not dragging a
99
- // selection (this matches native `select` event behavior).
100
- if (mouseDown || activeElement != getActiveElement()) {
99
+ // selection (this matches native `select` event behavior). In HTML5, select
100
+ // fires only on input and textarea thus if there's no focused element we
101
+ // won't dispatch.
102
+ if (mouseDown ||
103
+ activeElement == null ||
104
+ activeElement != getActiveElement()) {
105
return;
106
}
107