From a501cbde9a18259f54209ee4f62c96461d804300 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Thu, 23 Mar 2017 15:33:49 +0200 Subject: [PATCH] Document why predictions hover checking is needed --- .../LocationAutocompleteInput/LocationAutocompleteInput.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js b/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js index 5140ad03..ac96b6e1 100644 --- a/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js +++ b/src/components/LocationAutocompleteInput/LocationAutocompleteInput.js @@ -270,7 +270,12 @@ class LocationAutocompleteInput extends Component { // Only render predictions when the input has focus. For // development and easier workflow with the browser devtools, you // might want to hardcode this to `true`. Otherwise the dropdown - // list will disappear + // list will disappear. + // + // We also have to check if the predictions have hover to avoid a + // click triggering a blur event that hides the predictions before + // the click event is sent, resulting in a click to whatever is + // rendered below the predictions. const renderPredictions = this.state.inputHasFocus || this.state.predictionsHaveHover; return (