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

Can't select item from the menu in IE11

Open milencheto opened this issue 8 years ago • 14 comments

Hi, guys... I have a problem on IE11. When I open the menu, it shows my list, but I can't click on it to choosing some option. It looks like IE11 recognize the items just like a text but not links.. Can you help me?

milencheto avatar Jul 18 '17 12:07 milencheto

Hi Milena! Can you provide a reduced test case so we can help debug this problem? Perhaps it's reproducible in one of the examples?

CMTegner avatar Jul 18 '17 21:07 CMTegner

https://github.com/facebook/react/issues/6614 It looks like other people have the same and more problems with this component.

milencheto avatar Jul 24 '17 07:07 milencheto

I'm not sure how that React core issue relates to your original description. Is the autofill some how preventing you from selecting items from the menu?

CMTegner avatar Jul 24 '17 12:07 CMTegner

I just noticed this issue the latest version of Safari as well.

UPDATE: So it looks like Safari is requiring a double-click on the item to select, versus a single-click in chrome. May not be related to the original issue.

gregdillon avatar Jul 27 '17 14:07 gregdillon

@gregdillon seems like the examples work fine (i.e. only require a single click to select) in Safari. Can you provide a reduced test case that demonstrates the problem?

CMTegner avatar Jul 27 '17 15:07 CMTegner

@CMTegner I'll keep looking. Not sure what is going on and it may be my implementation. I'll report back if/when I figure out. Thanks.

gregdillon avatar Jul 27 '17 15:07 gregdillon

Any news? I also have this issue with IE11 and EDGE.

rek avatar Aug 07 '17 04:08 rek

@rek can you create a reduced test case which reproduces the error?

CMTegner avatar Aug 07 '17 15:08 CMTegner

Working on it :)

rek avatar Aug 08 '17 02:08 rek

Is there a JSFiddle or anything I can start from to try and reproduce this there?

rek avatar Aug 09 '17 07:08 rek

@rek try this JSBin: http://jsbin.com/mipesawapi/edit?js,output

CMTegner avatar Aug 19 '17 10:08 CMTegner

We found a fix for this. Our problem was in our implementation. It was because we had a dynamic Id in the inputProps.id directly, once we changed this it started working.

Here is what we changed it to:

import AutocompleteBase from 'autocomplete'

export class AutoComplete extends React.Component {
	autoCompleteId = _.uniqueId(this.props.id || 'autocomplete-')
	...
	render() {
		...

		return (
			<AutocompleteBase
				inputProps={{
					name: this.props.title,
					id: this.autoCompleteId,
				}}
				...
			/>
		)
	}
}

rek avatar Jun 27 '18 03:06 rek

@rek this didn't work for me. Also without id didn't work either.

dennisat avatar Jun 18 '19 06:06 dennisat

I found the bug in my code. The key in the shouldItemRender should be unique id per item and not new value.

In shouldItemRender as key of the JSX Element, I was assigned a different value always.

So I had something like this: shouldItemRender={(item, value)=><div key={this.cheapGuid++}>{value}</div>}

Yeah, I know, it is anti-pattern since it renders all the items always but I had no unique id there.

For some reason, in MS Browsers (IE11 & Edge) the items are not clickable till you assign a unique key for each item as key in shouldItemRender.

Ensure that the key is unique, otherwise, the items might flicker.

dennisat avatar Jun 18 '19 08:06 dennisat