Skip to content

Commit 4ce6519

Browse files
authored
Merge pull request #1781 from it-at-m/feature-zmskvr-921-progress-indicator-for-screen-reader-users
feat(ZMSKVR-921): progress bar for screen reader users
2 parents 709c68c + 3a14bcf commit 4ce6519

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

zmscitizenview/src/components/Appointment/AppointmentView.vue

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
>
6969
<muc-stepper
7070
v-if="!isAppointmentInPast"
71+
ref="stepperRef"
7172
:step-items="STEPPER_ITEMS"
7273
:active-item="activeStep"
7374
:disable-previous-steps="!!appointmentHash"
@@ -339,7 +340,15 @@ import {
339340
MucCallout,
340341
MucStepper,
341342
} from "@muenchen/muc-patternlab-vue";
342-
import { computed, nextTick, onMounted, provide, ref, watch } from "vue";
343+
import {
344+
ComponentPublicInstance,
345+
computed,
346+
nextTick,
347+
onMounted,
348+
provide,
349+
ref,
350+
watch,
351+
} from "vue";
343352
344353
import { AppointmentDTO } from "@/api/models/AppointmentDTO";
345354
import { Office } from "@/api/models/Office";
@@ -551,6 +560,26 @@ const apiErrorTranslation = computed<ApiErrorTranslation>(() => {
551560
);
552561
});
553562
563+
type StepperInstance = ComponentPublicInstance | HTMLElement | null;
564+
const stepperRef = ref<StepperInstance>(null);
565+
566+
const focusActiveStepperItem = async () => {
567+
await nextTick();
568+
569+
// Zugriff auf das gerenderte DOM des Steppers
570+
const rootEl =
571+
(stepperRef.value as ComponentPublicInstance | null)?.$el ??
572+
(stepperRef.value as HTMLElement | null);
573+
574+
if (!rootEl) return;
575+
576+
const activeIcon = rootEl.querySelector<HTMLElement>(
577+
".m-form-step__icon[aria-current='step']"
578+
);
579+
580+
activeIcon?.focus();
581+
};
582+
554583
// Track the current context based on API calls and props
555584
const currentContext = ref<string>("update");
556585
@@ -888,6 +917,7 @@ const nextCancelReschedule = () => {
888917
watch(currentView, (newCurrentView) => {
889918
activeStep.value = newCurrentView.toString();
890919
goToTop();
920+
focusActiveStepperItem();
891921
});
892922
893923
/**
@@ -1281,6 +1311,7 @@ onMounted(() => {
12811311
if (localStorage.getItem(LOCALSTORAGE_PARAM_APPOINTMENT_DATA)) {
12821312
localStorage.removeItem(LOCALSTORAGE_PARAM_APPOINTMENT_DATA);
12831313
}
1314+
focusActiveStepperItem();
12841315
});
12851316
</script>
12861317
<style lang="scss" scoped>

0 commit comments

Comments
 (0)