diff --git a/lib/components/term.js b/lib/components/term.js index f8c6900c..eaca996d 100644 --- a/lib/components/term.js +++ b/lib/components/term.js @@ -55,7 +55,12 @@ export default class Term extends PureComponent { } if (props.onActive) { - this.term.on('focus', props.onActive); + this.term.on('focus', () => { + // xterm@2 emits this event 2 times. Will be fixed in xterm@3. + if (!this.props.isTermActive) { + props.onActive(); + } + }); } if (props.onData) {