react-autocomplete icon indicating copy to clipboard operation
react-autocomplete copied to clipboard

Cannot click option from dropdown if autocomplete is inside scrollable container and not visible

Open jmpennala opened this issue 8 years ago • 5 comments

This probably relates to issue #240. If Autocomplete is inside a div which is scrollable and input goes outside the view, clicking item scrolls the input back to the view but no item is selected.

Reproduced with version 1.7.2 in Chrome 61.0.3163.100 (Official Build) (64-bit) OS: Mac OS X High Sierra

Tested with static-data-example by wrapping Autocomplete into this: <div style={{ height: '150px', overflow: 'scroll' }}>

jmpennala avatar Oct 19 '17 14:10 jmpennala

Hi! There's a fundamental flaw in how the current logic works, in that it doesn't account for nested scrollable panes. I am working on a fix which makes it more resilient.

CMTegner avatar Nov 26 '17 10:11 CMTegner

Hi, I was having this problem too so I started investigating. Seems it's something to do with the lines

onMouseEnter: () => this.setIgnoreBlur(true),
onMouseLeave: () => this.setIgnoreBlur(false),

in the renderMenu method. If you comment those lines out, it works okay. However, I'm not quite sure of the side-effects of doing so.

Happy to help out on this if I can.

ChrisSargent avatar Dec 27 '17 17:12 ChrisSargent

Or commenting this.refs.input.focus(); in the handleInputBlur method.

ChrisSargent avatar Dec 27 '17 17:12 ChrisSargent

@ChrisSargent yep, that's correct. However, we want the input to remain focused after the user has selected an item, so the challenge lies in figuring out a solution without removing that behaviour.

CMTegner avatar Feb 04 '18 09:02 CMTegner

@CMTegner Any Update??

Samrat-Saha-Sammy avatar May 14 '19 15:05 Samrat-Saha-Sammy