Compare commits

...

3 Commits

Author SHA1 Message Date
Jürgen Mummert 21c18f94a0 Improve Tom Select usability and accessibility defaults 2026-02-23 20:54:25 +01:00
Jürgen Mummert 0402c74824 Fix Tom Select input wrapping and restore arrow icon 2026-02-23 20:49:26 +01:00
Jürgen Mummert e3c13c989b Keep Tom Select setup core-only 2026-02-23 20:43:43 +01:00
@@ -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,13 +69,13 @@
} }
#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] {
@@ -83,27 +83,15 @@
} }
#eventfilters .ts-wrapper.single .ts-control { #eventfilters .ts-wrapper.single .ts-control {
position: relative; 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; padding-right: 2rem;
} }
#eventfilters .ts-wrapper.single .ts-control::after { #eventfilters .ts-wrapper.single .ts-control > input {
content: ''; width: auto;
position: absolute;
right: 0.75rem;
top: 50%;
width: 0;
height: 0;
border-left: 0.3rem solid transparent;
border-right: 0.3rem solid transparent;
border-top: 0.4rem solid currentColor;
transform: translateY(-30%);
pointer-events: none;
opacity: 0.7;
}
#eventfilters .ts-wrapper.single.dropdown-active .ts-control::after {
transform: translateY(-65%) rotate(180deg);
} }
</style> </style>
@@ -148,21 +136,18 @@
} }
return new window.TomSelect(selectElement, { return new window.TomSelect(selectElement, {
create: true, create: false,
sortField: { sortField: {
field: 'text', field: 'text',
direction: 'asc', direction: 'asc',
}, },
onInitialize() { render: {
if (!this.control_input) { no_results() {
return; return '<div class="no-results" role="option" aria-disabled="true">Keine Ergebnisse gefunden</div>';
} },
no_more_results() {
this.control_input.setAttribute('autocomplete', 'off'); return '<div class="no-more-results" role="option" aria-disabled="true">Keine weiteren Ergebnisse</div>';
this.control_input.setAttribute('autocorrect', 'off'); },
this.control_input.setAttribute('autocapitalize', 'off');
this.control_input.setAttribute('spellcheck', 'false');
this.control_input.setAttribute('name', `${selectElement.id}-ts-input`);
}, },
}); });
}; };