Allow custom focus target for a11y
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
2ac3755120
commit
411d7eca6c
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue