[SalesForce] tag in Lightning do not have keyup attribute

I am facing the issue with :

I am using a lookup with lightning: input. When the user clicks enter search text in this input field. New component opens up showing related search records.

Now to close search window, I have a cross button in front of the field.

The user wants that on clicking anywhere outside search result component/box. This component should get closed. Now I am unable to find any workaround of attribute keyUp which we use in ui:input. Any idea how to achieve that.

enter image description here

Best Answer

You can add the keyup to and input field, you just have to specify UpdateOn so that the change event triggers on keyup

<ui:inputText aura:id="searchInput" 
    label="Search" 
    keyup="{!c.performSearch}" 
    updateOn="keyup" />

Source

Edit: I'm pretty sure this will work on a lightning:input as well, but I haven't tested that.

Related Topic