summaryrefslogtreecommitdiffstats
path: root/web/react/components/mention_list.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components/mention_list.jsx')
-rw-r--r--web/react/components/mention_list.jsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/web/react/components/mention_list.jsx b/web/react/components/mention_list.jsx
index 2fecc129a..3fac41073 100644
--- a/web/react/components/mention_list.jsx
+++ b/web/react/components/mention_list.jsx
@@ -14,7 +14,7 @@ module.exports = React.createClass({
PostStore.addMentionDataChangeListener(this._onChange);
var self = this;
- $('#'+this.props.id).on('keypress.mentionlist',
+ $('body').on('keypress.mentionlist', '#'+this.props.id,
function(e) {
if (!self.isEmpty() && self.state.mentionText != '-1' && e.which === 13) {
e.stopPropagation();
@@ -23,15 +23,16 @@ module.exports = React.createClass({
}
}
);
- $(document).click(function() {
- if($('#'+self.props.id).length && $('#'+self.props.id).get(0) !== $(':focus').get(0)) {
+ $(document).click(function(e) {
+ if (!($('#'+self.props.id).is(e.target) || $('#'+self.props.id).has(e.target).length ||
+ ('mentionlist' in self.refs && $(self.refs['mentionlist'].getDOMNode()).has(e.target).length))) {
self.setState({mentionText: "-1"})
}
});
},
componentWillUnmount: function() {
PostStore.removeMentionDataChangeListener(this._onChange);
- $('#'+this.props.id).off('keypress.mentionlist');
+ $('body').off('keypress.mentionlist', '#'+this.props.id);
},
_onChange: function(id, mentionText, excludeList) {
if (id !== this.props.id) return;