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

onOptionSelected does not trigger on click

Open amitava82 opened this issue 8 years ago • 4 comments

2.0.0-alpha.5 Only keyboard event works

amitava82 avatar Jun 16 '16 06:06 amitava82

FYI https://github.com/HubSpot/react-typeahead/pull/6 has a quick workaround that uses onMouseDown instead of onClick to check for clicks on options. If this is still appropriate behavior for the typeahead, I can patch to this repo

zdhickman avatar Jun 26 '16 22:06 zdhickman

I had this issue, but in my case, I was trying to hide results onBlur. The blur was firing before the selection was made. Just putting that here incase it helps you or anyone else

em0ney avatar Aug 31 '16 04:08 em0ney

@zdhickman is there anyway to get an onlick or onmousedown event right now? I tried both and neither work? I'm using css to expand/contract the search box on focus, which isn't allowing me to use onclick to send the typeahead slection

jennykortina avatar Nov 21 '16 17:11 jennykortina

I had this issue, I fixed with a setTimeout while they patch a better solution.

onBlur(e) {
    e.stopPropagation();
    e.preventDefault();
    setTimeout(() => {
        if (this.refs.typeahead.state['showResults']) this.refs.typeahead.setState({showResults: false})
    }, 150);
}

mateuspontes avatar Feb 17 '17 18:02 mateuspontes