Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

LostFocus on outer div triggers on inner div

$
0
0

I have:

<div @onfocusout="@((e) => HidedicList(e))"><input for="toggleVendors" class="form-control label-toggle" placeholder="Vendor Information" @onchange="selectedValue" @onfocus="@((e) => ShowdicList(e))" /><input type="checkbox" id="toggleVendors" class="hidden-checkbox" ><div id="diclist" class="@showhide"><ul>            @foreach (var item in (Dictionary<int,string>)this.selectListItems.Items)            {<li><input type="checkbox" id="@item.Key" @onchange="@((e) => CheckboxChanged(e, @item.Key))" value="@item.Value" /> @item.Value</li>            }</ul></div></div>

I am trying to 'roll my own' dropdown (there are valid reasons why I cant use existing methods such as a datalist with options) everything seems to work accept when focus is lost on the whole div, i want to close the inner div. So I click into my input box and my inner div shows my items. As soon as I start attempting to select one of my checkboxes in the list, the onfocusout event triggers on my outer div. If I move the event to my inner div, it doesn't trigger the event straight away, but it still triggers after I've made a selection of a checkbox in the list.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>