React-autosuggest: Suggestions list stuck open after dragging a suggestion outside of the autosuggest

Created on 24 Jul 2017  路  8Comments  路  Source: moroshko/react-autosuggest

Most helpful comment

  1. The Mousedown handler is called and justSelectedSuggestion is set to true
  2. Then the input is blurred by the browser because you've clicked/dragged on another element other than the input box (aria-activedescendant doesn't seem to be doing its job)
  3. Even clicking the input box to try focus and unfocus it doesn't work because justSelectedSuggestion remains true and isn't set back to false except until you click a suggestion.

This code separates the blurring of the input box from the hiding of the container

if (!_this2.justSelectedSuggestion) { _this2.onBlur(); _this2.onSuggestionsClearRequested(); }

I'm still trying to figure out a fix for this, but this is the cause I believe.

All 8 comments

Having read callemall/material-ui#7526, it's not clear to me what the issue is.

Could you please list the steps to reproduce the issue?

cc @oliviertassinari

Here is an example, I hope that helps:

juil -24-2017 16-45-12

After you drag the suggestion, the focus is no longer on the input.
What exactly do you expect to happen when pressing Up/Down afterwards?

@moroshko I don't think that the issue is with the keybinding, but rather with an opened suggestion list. Focusing and blurring the input will no longer close the suggestions.

I'm experiencing the same behavior after the click hold and mouse-out, where the suggestions will no longer close. Did anyone figure out a work around?

Yep, it's a bug.

In case anyone would like to contribute a PR, here are the steps to reproduce it:

  1. Visit http://react-autosuggest.js.org
  2. Focus on the Basic example input
  3. Type c
  4. Drag one of the suggestions to the rest of the page

Observed behavior: The input loses focus, causing the suggestions to be stuck in a visible state (clicking outside of the autosuggest doesn't close the suggestions).

Expected behavior: The input keeps focus. Clicking outside of the autosuggest closes the suggestions. See Google's autosuggest as an example.

  1. The Mousedown handler is called and justSelectedSuggestion is set to true
  2. Then the input is blurred by the browser because you've clicked/dragged on another element other than the input box (aria-activedescendant doesn't seem to be doing its job)
  3. Even clicking the input box to try focus and unfocus it doesn't work because justSelectedSuggestion remains true and isn't set back to false except until you click a suggestion.

This code separates the blurring of the input box from the hiding of the container

if (!_this2.justSelectedSuggestion) { _this2.onBlur(); _this2.onSuggestionsClearRequested(); }

I'm still trying to figure out a fix for this, but this is the cause I believe.

Have anyone fix this issues? could you share how to fix this issues?

Was this page helpful?
0 / 5 - 0 ratings