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

Fix multiple blur events

parent d184ded2
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,15 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -33,7 +33,15 @@ class PersonSelect extends VPULitElementJQuery {
this.updateComplete.then(()=>{ this.updateComplete.then(()=>{
that.$select = that.$('#person-select'); that.$select = that.$('#person-select');
})
// 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(() => {that.$select.select2('close')}, 500);
console.log("blur");
});
});
} }
/** /**
...@@ -129,13 +137,6 @@ class PersonSelect extends VPULitElementJQuery { ...@@ -129,13 +137,6 @@ class PersonSelect extends VPULitElementJQuery {
JSONLD.initialize(this.entryPointUrl, function (jsonld) { JSONLD.initialize(this.entryPointUrl, function (jsonld) {
that.jsonld = jsonld; that.jsonld = jsonld;
that.$select = that.initSelect2(); that.$select = that.initSelect2();
// 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(() => {that.$select.select2('close')}, 500);
});
}); });
break; break;
} }
......
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