|
68 | 68 | > |
69 | 69 | <muc-stepper |
70 | 70 | v-if="!isAppointmentInPast" |
| 71 | + ref="stepperRef" |
71 | 72 | :step-items="STEPPER_ITEMS" |
72 | 73 | :active-item="activeStep" |
73 | 74 | :disable-previous-steps="!!appointmentHash" |
@@ -339,7 +340,15 @@ import { |
339 | 340 | MucCallout, |
340 | 341 | MucStepper, |
341 | 342 | } 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"; |
343 | 352 |
|
344 | 353 | import { AppointmentDTO } from "@/api/models/AppointmentDTO"; |
345 | 354 | import { Office } from "@/api/models/Office"; |
@@ -551,6 +560,26 @@ const apiErrorTranslation = computed<ApiErrorTranslation>(() => { |
551 | 560 | ); |
552 | 561 | }); |
553 | 562 |
|
| 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 | +
|
554 | 583 | // Track the current context based on API calls and props |
555 | 584 | const currentContext = ref<string>("update"); |
556 | 585 |
|
@@ -888,6 +917,7 @@ const nextCancelReschedule = () => { |
888 | 917 | watch(currentView, (newCurrentView) => { |
889 | 918 | activeStep.value = newCurrentView.toString(); |
890 | 919 | goToTop(); |
| 920 | + focusActiveStepperItem(); |
891 | 921 | }); |
892 | 922 |
|
893 | 923 | /** |
@@ -1281,6 +1311,7 @@ onMounted(() => { |
1281 | 1311 | if (localStorage.getItem(LOCALSTORAGE_PARAM_APPOINTMENT_DATA)) { |
1282 | 1312 | localStorage.removeItem(LOCALSTORAGE_PARAM_APPOINTMENT_DATA); |
1283 | 1313 | } |
| 1314 | + focusActiveStepperItem(); |
1284 | 1315 | }); |
1285 | 1316 | </script> |
1286 | 1317 | <style lang="scss" scoped> |
|
0 commit comments