fmoo / react-typeahead

Pure react-based typeahead and typeahead-tokenizer
ISC License
677 stars 232 forks source link

Adds onMouseDown workaround to TypeaheadOption #235

Closed kuzzmi closed 7 years ago

kuzzmi commented 7 years ago

onClick is not fired when clicked on a TypeaheadOption. This adds a onMouseDown workaround with the same handler to handle clicks by default.

Adds tests to test onClick and onMouseDown events, onClick test is set as pending until resolved.

Since the whole master branch test suit fails as mentioned in #229, these tests couldn't be verified, but should be fine as soon as the main issue is resolved.

kuzzmi commented 7 years ago

This was also mentioned in the #205

fmoo commented 7 years ago

This feels like a hack. Do we know why click events aren't propagating properly? is it because we're incorrectly stopping cancelling / stopping propagation elsewhere in the stack?

kuzzmi commented 7 years ago

It is, and it's not at the same time. It's hard to tell why onClick doesn't work, as tests are broken, however this is the only way to make it working right now. The only reason why IMO it might make sense to have this workaround is that currently clicking doesn't work at all and people fork this repo exactly for applying this "fix".

I'd be happy to fix the root cause, however I couldn't identify it, and it will take a while to fix the tests, so we can isolate this root cause.

fmoo commented 7 years ago

Cool, I'll merge this, but can you open a followup Issue to "Remove the onMouseDown hack from #235" ?

kuzzmi commented 7 years ago

Added #237 issue to get rid of this hack.