Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97e4f639a0 | |||
| b714bbeb1b | |||
| 21c18f94a0 | |||
| 0402c74824 |
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" id="eventfilter-reset" class="eventfilter-reset" hidden>Filter zurücksetzen</button>
|
<button type="button" id="eventfilter-reset" class="eventfilter-reset" aria-label="Alle Filter zurücksetzen" aria-controls="{{ targetEventListId|default('eventlist')|e('html_attr') }}" hidden>Filter zurücksetzen</button>
|
||||||
|
|
||||||
<p id="eventfilter-status" class="visually-hidden" aria-live="polite"></p>
|
<p id="eventfilter-status" class="visually-hidden" aria-live="polite"></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,23 +69,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#eventfilters .widget-select.active .ts-control {
|
#eventfilters .widget-select.active .ts-control {
|
||||||
outline: 2px solid currentColor;
|
outline: 3px solid currentColor;
|
||||||
outline-offset: 2px;
|
outline-offset: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventfilters .ts-control:focus-within {
|
#eventfilters .ts-control:focus-within {
|
||||||
outline: 2px solid currentColor;
|
outline: 3px solid currentColor;
|
||||||
outline-offset: 2px;
|
outline-offset: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventfilters .eventfilter-reset[hidden] {
|
#eventfilters .eventfilter-reset[hidden] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#eventfilters .ts-wrapper.single .ts-control {
|
||||||
|
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right 0.75rem center;
|
||||||
|
background-size: 16px 12px;
|
||||||
|
padding-right: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#eventfilters .ts-wrapper.single .ts-control > input {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.css">
|
<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.4.3/dist/js/tom-select.complete.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/tom-select@2/dist/js/tom-select.complete.min.js"></script>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
const filters = document.getElementById('eventfilters');
|
const filters = document.getElementById('eventfilters');
|
||||||
@@ -123,12 +135,46 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let shouldBlurOnChange = false;
|
||||||
|
|
||||||
return new window.TomSelect(selectElement, {
|
return new window.TomSelect(selectElement, {
|
||||||
create: true,
|
create: false,
|
||||||
sortField: {
|
sortField: {
|
||||||
field: 'text',
|
field: 'text',
|
||||||
direction: 'asc',
|
direction: 'asc',
|
||||||
},
|
},
|
||||||
|
render: {
|
||||||
|
no_results() {
|
||||||
|
return '<div class="no-results" role="option" aria-disabled="true">Keine Ergebnisse gefunden</div>';
|
||||||
|
},
|
||||||
|
no_more_results() {
|
||||||
|
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