From 411d7eca6cea346c7a18c89556a697b9fa2ba4f9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 10 Jan 2022 10:19:27 +0100 Subject: [PATCH] Allow custom focus target for a11y Signed-off-by: Thomas Citharel --- js/src/App.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/src/App.vue b/js/src/App.vue index 521346415..d8a7cd4df 100644 --- a/js/src/App.vue +++ b/js/src/App.vue @@ -216,7 +216,11 @@ export default class App extends Vue { // Set the focus to the router view // https://marcus.io/blog/accessible-routing-vuejs setTimeout(() => { - const focusTarget = this.routerView?.$el as HTMLElement; + const focusTarget = ( + this.routerView?.$refs?.componentFocusTarget !== undefined + ? this.routerView?.$refs?.componentFocusTarget + : this.routerView?.$el + ) as HTMLElement; if (focusTarget) { // Make focustarget programmatically focussable focusTarget.setAttribute("tabindex", "-1");