Skip to content

Commit 648779d

Browse files
committedMay 27, 2020
chore: making the sidebar button focusable and adding the aria label
1 parent dfe0a62 commit 648779d

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

‎layouts/Layout.vue

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default {
4848
this.setMainId()
4949
this.setWarningInExternalLinks()
5050
this.setComplementRouteToAnnouncer()
51+
this.setTabIndexSidebarButton()
5152
})
5253
},
5354
@@ -70,6 +71,13 @@ export default {
7071
if (this.$themeLocaleConfig.announcer) {
7172
this.$announcer.setComplementRoute(this.$themeLocaleConfig.announcer.complementRoute)
7273
}
74+
},
75+
76+
setTabIndexSidebarButton () {
77+
const el = document.querySelector('.sidebar-button')
78+
if (!el) return
79+
el.setAttribute('tabindex', 0)
80+
el.setAttribute('aria-label', 'Open Sidebar Navigation')
7381
}
7482
}
7583
}

‎styles/override/index.styl

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@require './custom-block.styl'
33
@require './search.styl'
44
@require './sidebar.styl'
5+
@require './navbar.styl'
56

67
.page-edit .edit-link > a
78
color var(--text-color-link)

‎styles/override/sidebar.styl

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
// SIDEBAR LINKS
12
.sidebar-links
23
> li
34
margin: 6px 0
5+
width: 95%
6+
margin-left: 2.5%
47

58
.sidebar-sub-headers
69
margin-top: 5px
@@ -18,7 +21,20 @@ a.sidebar-link
1821
&.active
1922
border-left-color var(--accent-color)
2023

24+
// SIDEBAR BUTTON
25+
.sidebar-button
26+
padding: 1.2rem 1.3rem
27+
top: 0.7rem
28+
.icon
29+
position: absolute
30+
31+
// MOBILE
2132
@media (max-width: $MQMobile)
33+
.sidebar-button
34+
display: flex
35+
justify-content: center
36+
align-items: center
37+
2238
.theme-container.sidebar-open .sidebar
2339
visibility: visible
2440

0 commit comments

Comments
 (0)
Please sign in to comment.