Skip to content

Commit add2c85

Browse files
authored
Merge pull request #17385 from rak-phillip/task/16253-skip-to-main
Add skip to main content link
2 parents d3144a6 + 0808eb2 commit add2c85

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

shell/assets/translations/en-us.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ locale:
185185
none: (None)
186186

187187
nav:
188+
skipToContent: Skip to main content
188189
ariaLabel:
189190
clusterIconKeyCombo: Cluster keyboard shortcut combination icon
190191
localClusterIcon: Local Cluster icon

shell/components/templates/default.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ export default {
159159
160160
<template>
161161
<div class="dashboard-root">
162+
<a
163+
href="#main-content"
164+
class="skip-to-content btn role-primary"
165+
>{{ t('nav.skipToContent') }}</a>
162166
<FixedBanner :header="true" />
163167
<AwsComplianceBanner v-if="managementReady" />
164168
<div
@@ -173,8 +177,10 @@ export default {
173177
/>
174178
<main
175179
v-if="clusterAndRouteReady"
180+
id="main-content"
176181
class="main-layout"
177182
:aria-label="t('layouts.default')"
183+
tabindex="-1"
178184
>
179185
<router-view
180186
:key="$route.path"
@@ -211,8 +217,10 @@ export default {
211217
<!-- Ensure there's an outlet to show the error (404) page -->
212218
<main
213219
v-else-if="unmatchedRoute"
220+
id="main-content"
214221
class="main-layout"
215222
:aria-label="t('layouts.default')"
223+
tabindex="-1"
216224
>
217225
<router-view
218226
:key="$route.path"
@@ -227,3 +235,17 @@ export default {
227235
<Inactivity />
228236
</div>
229237
</template>
238+
239+
<style lang="scss" scoped>
240+
.skip-to-content {
241+
position: fixed;
242+
top: 0;
243+
left: 0;
244+
z-index: 9999;
245+
transform: translateY(-100%);
246+
247+
&:focus {
248+
transform: translate(1rem, 1rem);
249+
}
250+
}
251+
</style>

0 commit comments

Comments
 (0)