From 428444d1852f3949ece0a9f6b73843f46c4a0fb7 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 4 Nov 2016 19:11:40 -0400 Subject: PLT-4459 Fixed not being able to scroll on mobile after autocomplete is shown (#4464) * Fixed not being able to scroll on mobile after autocomplete is shown * Fixed SuggestionLists not being scrollable on iOS --- webapp/components/suggestion/suggestion_box.jsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'webapp/components/suggestion/suggestion_box.jsx') diff --git a/webapp/components/suggestion/suggestion_box.jsx b/webapp/components/suggestion/suggestion_box.jsx index 21bfd3dc3..464e57ef2 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 touchstart', this.handleDocumentClick); + $(document).on('click', 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 touchstart', this.handleDocumentClick); + $(document).off('click', this.handleDocumentClick); } getTextbox() { @@ -60,14 +60,14 @@ 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 (!SuggestionStore.hasSuggestions(this.suggestionId)) { + return; } + + const container = $(ReactDOM.findDOMNode(this)); + 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 + // We can't just use blur for this because it fires and hides the children before // their click handlers can be called GlobalActions.emitClearSuggestions(this.suggestionId); } -- cgit v1.2.3-1-g7c22