Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/renderers/dom/client/eventPlugins/SelectEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

var EventConstants = require('EventConstants');
var EventPropagators = require('EventPropagators');
var ExecutionEnvironment = require('ExecutionEnvironment');
var ReactInputSelection = require('ReactInputSelection');
var SyntheticEvent = require('SyntheticEvent');

Expand All @@ -23,6 +24,12 @@ var shallowEqual = require('shallowEqual');

var topLevelTypes = EventConstants.topLevelTypes;

var skipSelectionChangeEvent = (
ExecutionEnvironment.canUseDOM &&
'documentMode' in document &&
document.documentMode <= 11
);

var eventTypes = {
select: {
phasedRegistrationNames: {
Expand Down Expand Up @@ -189,12 +196,18 @@ var SelectEventPlugin = {
return constructSelectEvent(nativeEvent, nativeEventTarget);

// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't).
// sometimes when it hasn't). IE's event fires out of order with respect
// to key and input events on deletion, so we discard it.
//
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
if (skipSelectionChangeEvent) {
break;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this fails lint because of http://eslint.org/docs/rules/no-fallthrough but adding // fall through here doesn't seem to silence it even though it looks like it should. @bgw any ideas?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// fall through is only supported in ESLint 1.0.0. I think we're on an older version, so in that case, you need to pluralize fall to // falls through.

Also, make sure it's the last thing in the case, after the conditional.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, that worked.

case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
return constructSelectEvent(nativeEvent, nativeEventTarget);
Expand Down