Skip to content
Snippets Groups Projects
Commit 77fbb7bd authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Allow closing of selector by clicking outside web component

parent 1aefed62
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,9 @@ class PersonSelect extends VPULitElement {
"text": "http://schema.org/name"
};
that.$('#person-select').select2({
const $select = that.$('#person-select');
$select.select2({
width: '100%',
language: that.lang === "de" ? select2LangDe() : select2LangEn(),
minimumInputLength: 2,
......@@ -93,6 +95,13 @@ class PersonSelect extends VPULitElement {
bubbles: true
}));
});
// close the selector on blur of the web component
$(that).blur(() => {
// the 500ms delay is a workaround to actually get an item selected when clicking on it,
// because the blur gets also fired when clicking in the selector
setTimeout(() => {$select.select2('close')}, 500);
});
});
})
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment