1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 07:52:43 +00:00

Fix focustarget in some cases

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-10-13 12:52:57 +02:00
parent a9e36aaacb
commit 44f90c7b0b
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -216,7 +216,8 @@ export default class App extends Vue {
// Set the focus to the router view // Set the focus to the router view
// https://marcus.io/blog/accessible-routing-vuejs // https://marcus.io/blog/accessible-routing-vuejs
setTimeout(() => { setTimeout(() => {
const focusTarget = this.routerView.$el as HTMLElement; const focusTarget = this.routerView?.$el as HTMLElement;
if (focusTarget) {
// Make focustarget programmatically focussable // Make focustarget programmatically focussable
focusTarget.setAttribute("tabindex", "-1"); focusTarget.setAttribute("tabindex", "-1");
@ -226,6 +227,7 @@ export default class App extends Vue {
// Remove tabindex from focustarget. // Remove tabindex from focustarget.
// Reason: https://axesslab.com/skip-links/#update-3-a-comment-from-gov-uk // Reason: https://axesslab.com/skip-links/#update-3-a-comment-from-gov-uk
focusTarget.removeAttribute("tabindex"); focusTarget.removeAttribute("tabindex");
}
}, 0); }, 0);
} }