File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template >
22 <q-layout view =" hHh lpR fFf" >
33 <q-header id =" header-inner" >
4- <Header v-on:togglePreview =" onTogglePreview" />
4+ <a
5+ class =" skip-to-main-content-link"
6+ href =" #middle"
7+ id =" skipToMain"
8+ v-on:blur =" skipToMainFocused = false"
9+ v-on:click.prevent =" focusMain"
10+ v-on:focus =" skipToMainFocused = true"
11+ >
12+ Skip to main content
13+ </a >
14+ <Header
15+ v-on:togglePreview =" onTogglePreview"
16+ />
517 </q-header >
618
719 <q-drawer
3446 <q-page
3547 id =" middle"
3648 class =" row"
49+ role =" main"
50+ tabindex =" 0"
3751 >
3852 <Stepper />
3953 <div
@@ -92,12 +106,18 @@ export default defineComponent({
92106 setup () {
93107 const isPreviewDrawerEnabled = ref (false )
94108 return {
109+ focusMain : () => {
110+ const element = window .document .getElementById (' middle' )
111+ if (! element ) return
112+ element .focus ()
113+ },
95114 isNotFinish: computed (() => {
96115 const currentPath = useRoute ().path
97116 return currentPath !== ' /finish'
98117 }),
99118 isPreviewDrawerEnabled ,
100- onTogglePreview : () => { isPreviewDrawerEnabled .value = ! isPreviewDrawerEnabled .value }
119+ onTogglePreview : () => { isPreviewDrawerEnabled .value = ! isPreviewDrawerEnabled .value },
120+ skipToMainFocused: ref (false )
101121 }
102122 }
103123})
@@ -106,4 +126,18 @@ export default defineComponent({
106126.spacer {
107127 flex-grow : 1.0 ;
108128}
129+ .skip-to-main-content-link {
130+ position : absolute ;
131+ left : -9999px ;
132+ z-index : 999 ;
133+ padding : 1em ;
134+ background-color : black ;
135+ color : white ;
136+ opacity : 0 ;
137+ }
138+ .skip-to-main-content-link :focus {
139+ left : 50% ;
140+ transform : translateX (-50% );
141+ opacity : 1 ;
142+ }
109143 </style >
You can’t perform that action at this time.
0 commit comments