resolve migration TODOs: properly refocus parent on navigations

This commit is contained in:
rash
2026-03-13 13:24:31 +01:00
parent 7251ae953d
commit 8945e55900
2 changed files with 13 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, inject, ref, watch, onMounted, onBeforeUnmount } from 'vue'
import { computed, inject, ref, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
import { StoreKey } from '~/sharedStore'
import { STRINGS } from '~/i18n'
import Category from './Category.vue'
@@ -45,7 +45,7 @@ const hiddenParams = computed(() => {
const showVoucherForm = computed(() => store.vouchersExist && !store.disableVouchers && !store.voucherCode)
function backToList () {
async function backToList () {
store.targetUrl = store.parentStack.pop() || store.targetUrl
store.error = null
if (!store.subevent) {
@@ -66,12 +66,10 @@ function backToList () {
store.view = 'weeks'
}
// TODO
// let $el = this.$root.$el
// this.$root.$nextTick(function () {
// // wait for redraw, then focus content element for better a11y
// $el.focus()
// })
// wait for redraw, then focus content element for better a11y
const rootEl = form.value?.closest('.pretix-widget-wrapper') as HTMLElement | null
await nextTick()
rootEl?.focus()
}
function calcItemsSelected () {

View File

@@ -9,12 +9,12 @@ const store = inject(StoreKey)!
const displayEventInfo = computed(() => store.displayEventInfo || (store.displayEventInfo === null && store.parentStack.length > 0))
function backToCalendar () {
// TODO
async function backToCalendar (event: MouseEvent) {
// make sure to always focus content element
// this.$nextTick(function () {
// this.$root.$el.focus()
// })
await nextTick()
const rootEl = (event.target as HTMLElement).closest('.pretix-widget-wrapper') as HTMLElement | null
rootEl?.focus()
store.offset = 0
store.appendEvents = false
@@ -37,6 +37,8 @@ function loadMore () {
store.loading++
store.reload()
}
console.log(store)
</script>
<template lang="pug">
.pretix-widget-event-list