chore: accessibility of filters

This commit is contained in:
2024-05-03 19:29:10 +02:00
parent ff041b9aaf
commit 7dd1c06f3f
4 changed files with 281 additions and 288 deletions
@@ -9,7 +9,7 @@
ref="button" ref="button"
> >
<img src="/images/icon-filter2.svg" alt="Open filters" /> <img src="/images/icon-filter2.svg" alt="Open filters" />
{{ $t('options.filters') }} [F] [F] {{ $t('options.filters') }}
<span class="active-indicator" v-if="currentOptionsActive"></span> <span class="active-indicator" v-if="currentOptionsActive"></span>
</button> </button>
@@ -3,7 +3,7 @@
<div class="card_controls"> <div class="card_controls">
<button class="btn--filled btn--image" @click="toggleCard"> <button class="btn--filled btn--image" @click="toggleCard">
<img class="button_icon" src="/images/icon-filter2.svg" alt="filter icon" /> <img class="button_icon" src="/images/icon-filter2.svg" alt="filter icon" />
{{ $t('options.filters') }} [F] [F] {{ $t('options.filters') }}
<span class="active-indicator" v-if="!filterStore.areFiltersAtDefault"></span> <span class="active-indicator" v-if="!filterStore.areFiltersAtDefault"></span>
</button> </button>
@@ -28,8 +28,8 @@
</div> </div>
<transition name="card-anim"> <transition name="card-anim">
<div class="card" v-if="isVisible" tabindex="0" ref="cardEl"> <div class="card" v-if="isVisible" tabindex="0" ref="cardRef" @keydown.r="resetFilters">
<div class="card_content"> <div class="card_content" @scroll="onScroll" ref="cardContentRef">
<div class="card_title flex">{{ $t('filters.title') }}</div> <div class="card_title flex">{{ $t('filters.title') }}</div>
<p class="card_info" v-html="$t('filters.desc')"></p> <p class="card_info" v-html="$t('filters.desc')"></p>
@@ -137,7 +137,7 @@
:disabled="filterStore.areFiltersAtDefault" :disabled="filterStore.areFiltersAtDefault"
:data-disabled="filterStore.areFiltersAtDefault" :data-disabled="filterStore.areFiltersAtDefault"
> >
{{ $t('filters.reset') }} [R] {{ $t('filters.reset') }}
</button> </button>
<button class="btn--action" @click="closeCard">{{ $t('filters.close') }}</button> <button class="btn--action" @click="closeCard">{{ $t('filters.close') }}</button>
</div> </div>
@@ -171,7 +171,10 @@ export default defineComponent({
currentRegion: { id: '', value: '' }, currentRegion: { id: '', value: '' },
delayInputTimer: -1, delayInputTimer: -1,
chosenSearchScenery: '' chosenSearchScenery: '',
scrollTop: 0,
lastFocusedEl: null as HTMLElement | null
}), }),
setup() { setup() {
@@ -237,7 +240,10 @@ export default defineComponent({
isVisible(value: boolean) { isVisible(value: boolean) {
this.$nextTick(() => { this.$nextTick(() => {
if (value) (this.$refs['cardEl'] as HTMLDivElement).focus(); if (value) {
(this.$refs['cardRef'] as HTMLDivElement).focus();
(this.$refs['cardContentRef'] as HTMLDivElement).scrollTop = this.scrollTop;
}
}); });
} }
}, },
@@ -248,6 +254,10 @@ export default defineComponent({
this.isVisible = !this.isVisible; this.isVisible = !this.isVisible;
}, },
onScroll(e: Event) {
this.scrollTop = (e.target as HTMLElement).scrollTop;
},
handleInput(e: Event) { handleInput(e: Event) {
const target = e.target as HTMLInputElement; const target = e.target as HTMLInputElement;
+4 -21
View File
@@ -1,7 +1,6 @@
<template> <template>
<section class="station_table"> <section class="station_table">
<transition name="status-anim" mode="out-in"> <div class="table_wrapper">
<div class="table_wrapper" :key="apiStore.dataStatuses.connection">
<table> <table>
<thead> <thead>
<tr> <tr>
@@ -143,9 +142,7 @@
) )
" "
> >
{{ {{ station.onlineInfo.dispatcherExp < 2 ? 'L' : station.onlineInfo.dispatcherExp }}
station.onlineInfo.dispatcherExp < 2 ? 'L' : station.onlineInfo.dispatcherExp
}}
</span> </span>
</td> </td>
@@ -287,15 +284,12 @@
</tbody> </tbody>
</table> </table>
<Loading <Loading v-if="apiStore.dataStatuses.connection == Status.Loading && stations.length == 0" />
v-if="apiStore.dataStatuses.connection == Status.Loading && stations.length == 0"
/>
<div class="no-stations" v-else-if="stations.length == 0"> <div class="no-stations" v-else-if="stations.length == 0">
{{ $t('sceneries.no-stations') }} {{ $t('sceneries.no-stations') }}
</div> </div>
</div> </div>
</transition>
</section> </section>
</template> </template>
@@ -395,20 +389,9 @@ export default defineComponent({
$rowCol: #424242; $rowCol: #424242;
.change-anim {
&-enter-active,
&-leave-active {
transition: opacity 100ms ease-in;
}
&-enter,
&-leave-to {
opacity: 0;
}
}
.table_wrapper { .table_wrapper {
overflow: auto; overflow: auto;
overflow-y: scroll;
font-weight: 500; font-weight: 500;
height: 90vh; height: 90vh;
min-height: 550px; min-height: 550px;
+1 -1
View File
@@ -4,7 +4,7 @@
<button class="filter-button btn--filled btn--image" @click="toggleShowOptions" ref="button"> <button class="filter-button btn--filled btn--image" @click="toggleShowOptions" ref="button">
<img src="/images/icon-filter2.svg" alt="Open filters icon" /> <img src="/images/icon-filter2.svg" alt="Open filters icon" />
{{ $t('options.filters') }} [F] [F] {{ $t('options.filters') }}
<span class="active-indicator" v-if="currentOptionsActive"></span> <span class="active-indicator" v-if="currentOptionsActive"></span>
</button> </button>