I am creating a custom template with a searchable select. There is focus (trigger)
, blur (trigger)
, keyup (delegate)
and value (bind)
bindings on the input element. The dropdown content is displayed in a div, inside the same div as this input. the dropdown is showing when focus is on the input box, but when I click one of the elements in my custom dropdown, the blur event fires before the click delegate would fire, and as such, i don't get a call to the selectThis()
method.
Template looks like this:
<template>
<require from="../searchabledropdown/searchabledropdown.css"></require>
<div class="dropdown">
<input type="text"
placeholder="Search.."
id="inputSearchField"
value.bind="searchValue"
keyup.delegate="findData()"
focus.trigger="changeVisibility(true)"
blur.trigger="changeVisibility(false)">
<div if.bind="visible" class="dropdown-content">
<a href="${'#' + option.thingId}" click.delegate="selectThis(option.thingId)" repeat.for="option of thingimabobs">${option.textValue}</a>
</div>
</div>
How can i get the click element to fire first, without hacking it with timeouts and stuff...? - I have tried setting the blur.trigger on the div
that contains the class="dropdown"
, but it won't trigger at all then...