srjp: poprawki dostępności modalu

This commit is contained in:
2023-09-04 18:37:52 +02:00
parent dbbbd33100
commit f77c13cbcf
8 changed files with 151 additions and 154 deletions
+4 -2
View File
@@ -1,4 +1,4 @@
import { defineComponent } from 'vue';
import { Ref, defineComponent } from 'vue';
import { useStore } from '../store/store';
export default defineComponent({
@@ -15,15 +15,17 @@ export default defineComponent({
},
methods: {
selectModalTrain(trainId: string) {
selectModalTrain(trainId: string, target?: EventTarget | null) {
this.store.chosenModalTrainId = trainId;
document.body.classList.add('no-scroll');
if (target) this.store.modalLastClickedTarget = target;
},
closeModal() {
this.store.chosenModalTrainId = undefined;
setTimeout(() => {
(this.store.modalLastClickedTarget as any)?.focus();
document.body.classList.remove('no-scroll');
}, 150);
},