My Situation
I have a custom DropDown with a filter text input above. The DropDown can be opened independently from the filter text input.
My Goal
I want the DropDown to close when the filter input loses focus and also when I click outside of the DropDown.
My Attempts
- I tried binding to the blur event on my root div element in the control, but it didn't work.
- I looked for internal component methods to override but couldn't find any.
Code Snippet
<div @blur="onRootLostFocus">
...
</div>
...
...
...
onRootLostFocus() {
console.log('LostFocus');
this.deactivateSearchPanel();
this.deactivateSelectionPanel();
}
The Solution
I realized that a div needs tabindex="0"
to be focusable, which solved my problem.