Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97e4f639a0 | |||
| b714bbeb1b |
@@ -96,8 +96,8 @@
|
||||
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2/dist/css/tom-select.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/tom-select@2/dist/js/tom-select.complete.min.js"></script>
|
||||
|
||||
<script type="module">
|
||||
const filters = document.getElementById('eventfilters');
|
||||
@@ -135,6 +135,8 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
let shouldBlurOnChange = false;
|
||||
|
||||
return new window.TomSelect(selectElement, {
|
||||
create: false,
|
||||
sortField: {
|
||||
@@ -149,6 +151,30 @@
|
||||
return '<div class="no-more-results" role="option" aria-disabled="true">Keine weiteren Ergebnisse</div>';
|
||||
},
|
||||
},
|
||||
onInitialize() {
|
||||
const markPointerInteraction = () => {
|
||||
shouldBlurOnChange = true;
|
||||
};
|
||||
|
||||
const markKeyboardInteraction = () => {
|
||||
shouldBlurOnChange = false;
|
||||
};
|
||||
|
||||
this.control.addEventListener('pointerdown', markPointerInteraction);
|
||||
this.control.addEventListener('touchstart', markPointerInteraction, { passive: true });
|
||||
this.control.addEventListener('keydown', markKeyboardInteraction);
|
||||
this.dropdown.addEventListener('pointerdown', markPointerInteraction);
|
||||
this.dropdown.addEventListener('touchstart', markPointerInteraction, { passive: true });
|
||||
this.dropdown.addEventListener('keydown', markKeyboardInteraction);
|
||||
},
|
||||
onChange() {
|
||||
if (!shouldBlurOnChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.blur();
|
||||
shouldBlurOnChange = false;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user