blob: 33faa381fc5f19efdb71a5f228ebf204b57e2962 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<template>
<div>
<app-header ref="focusTarget" @refresh="refresh" />
<b-container fluid class="page-container">
<b-row no-gutters>
<b-col tag="nav" cols="12" md="3" lg="2">
<app-navigation />
</b-col>
<b-col cols="12" md="9" lg="10">
<page-container>
<router-view ref="routerView" :key="routerKey" />
</page-container>
</b-col>
</b-row>
</b-container>
</div>
</template>
<script>
import AppHeader from '@/components/AppHeader';
import AppNavigation from '@/components/AppNavigation';
import PageContainer from '../components/Global/PageContainer';
export default {
name: 'App',
components: {
AppHeader,
AppNavigation,
PageContainer
},
data() {
return {
routerKey: 0
};
},
watch: {
$route: function() {
// $nextTick = DOM updated
this.$nextTick(function() {
// Get the focusTarget DOM element
let focusTarget = this.$refs.focusTarget.$el;
// Make focustarget programmatically focussable
focusTarget.setAttribute('tabindex', '-1');
// Focus element
focusTarget.focus();
// Remove tabindex from focustarget
// Reason: https://axesslab.com/skip-links/#update-3-a-comment-from-gov-uk
focusTarget.removeAttribute('tabindex');
});
}
},
methods: {
refresh() {
// Changing the component :key value will trigger
// a component re-rendering and 'refresh' the view
this.routerKey += 1;
}
}
};
</script>
<style lang="scss" scoped>
.page-container {
margin-right: 0;
margin-left: 0;
padding-right: 0;
padding-left: 0;
}
</style>
|