diff options
author | Asaad Mahmood <asaadmahmoodspin@users.noreply.github.com> | 2016-06-09 23:09:35 +0500 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-06-09 11:09:35 -0700 |
commit | f1eefd99e6e40621ace005afcb1c08c6a69a744e (patch) | |
tree | 662e87be9abb5a6af84b04b04f5b8ae60de1508e /webapp/components/suggestion/suggestion_box.jsx | |
parent | d52bd0f6dc446373da56585ff91a1c02d4dd7d00 (diff) | |
download | chat-f1eefd99e6e40621ace005afcb1c08c6a69a744e.tar.gz chat-f1eefd99e6e40621ace005afcb1c08c6a69a744e.tar.bz2 chat-f1eefd99e6e40621ace005afcb1c08c6a69a744e.zip |
PLT-3094 - Fixing autocomplete and image modal scrolling on mobile (#3279)
Diffstat (limited to 'webapp/components/suggestion/suggestion_box.jsx')
-rw-r--r-- | webapp/components/suggestion/suggestion_box.jsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx index 6260e179c..2184b9fab 100644 --- a/webapp/components/suggestion/suggestion_box.jsx +++ b/webapp/components/suggestion/suggestion_box.jsx @@ -31,7 +31,7 @@ export default class SuggestionBox extends React.Component { } componentDidMount() { - $(document).on('click', this.handleDocumentClick); + $(document).on('click touchstart', this.handleDocumentClick); SuggestionStore.addCompleteWordListener(this.suggestionId, this.handleCompleteWord); SuggestionStore.addPretextChangedListener(this.suggestionId, this.handlePretextChanged); @@ -42,7 +42,7 @@ export default class SuggestionBox extends React.Component { SuggestionStore.removePretextChangedListener(this.suggestionId, this.handlePretextChanged); SuggestionStore.unregisterSuggestionBox(this.suggestionId); - $(document).off('click', this.handleDocumentClick); + $(document).off('click touchstart', this.handleDocumentClick); } getTextbox() { @@ -58,6 +58,11 @@ export default class SuggestionBox extends React.Component { handleDocumentClick(e) { const container = $(ReactDOM.findDOMNode(this)); + if ($('.suggestion-list__content').length) { + if (!($(e.target).hasClass('suggestion-list__content') || $(e.target).parents().hasClass('suggestion-list__content'))) { + $('body').removeClass('modal-open'); + } + } if (!(container.is(e.target) || container.has(e.target).length > 0)) { // we can't just use blur for this because it fires and hides the children before // their click handlers can be called |