diff --git a/src/browser/eventPlugins/BeforeInputEventPlugin.js b/src/browser/eventPlugins/BeforeInputEventPlugin.js index c7ef71b988..d4248158ac 100644 --- a/src/browser/eventPlugins/BeforeInputEventPlugin.js +++ b/src/browser/eventPlugins/BeforeInputEventPlugin.js @@ -29,9 +29,22 @@ var keyOf = require('keyOf'); var canUseTextInputEvent = ( ExecutionEnvironment.canUseDOM && 'TextEvent' in window && - !('documentMode' in document) + !('documentMode' in document || isPresto()) ); +/** + * Opera <= 12 includes TextEvent in window, but does not fire + * text input events. Rely on keypress instead. + */ +function isPresto() { + var opera = window.opera; + return ( + typeof opera === 'object' && + typeof opera.version === 'function' && + parseInt(opera.version(), 10) <= 12 + ); +} + var SPACEBAR_CODE = 32; var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);