palantir/blueprint

Suggest: rightElement click

Open

#3,422 opened on Mar 15, 2019

View on GitHub
 (5 comments) (0 reactions) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
P3Package: selectType: bugType: questionhelp wanted

Description

Environment

  • Package version(s): blueprintjs/select 3.7.0
  • Browser and OS versions: Chrome 72 in Windows 10

Question

Hi,

I am uisng a Suggest component with a right icon. I passed a rightElement prop to the input in order to add an icon in the right side of it. However, clicking in this icon, nothing happens. How can I easily avoid that the icon catches the click button letting the input handle that event (and achieve the same experience of clicking in the other parts of the input) ? I could do it controlling manually when the popover is expanded or not but I would like to avoid that.

   const ColorSuggest = Suggest.ofType<IColor>();

    const icon = <Icon icon="chevron-down" onClick={this.onArrowClick} />;
    return (
      <>
      <ColorSuggest
        items={this.state.colors}
        itemPredicate={filterColor}
        itemRenderer={renderColor}
        onItemSelect={(color: IColor) => {console.log("On item select. Name = " + color.name);}}
        inputValueRenderer={this.renderInputValue}
        popoverProps={{minimal: true}}
        inputProps={{placeholder:"Search", className:"dropdown", rightElement: icon}}
      >        
      </ColorSuggest>
      </>
    );

Contributor guide