Skip to content

Commit

Permalink
Set navigation role and aria label on app navigation
Browse files Browse the repository at this point in the history
Makes it possible for screen readers to say the text of aria label
followed by the term "navigation" when entering that region.

Also added an optional arial label for the toggle.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Nov 19, 2020
1 parent 8ad992f commit 5d8e46c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/components/AppNavigation/AppNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ emit('toggle-navigation', {
<div
id="app-navigation-vue"
class="app-navigation"
role="navigation"
:aria-label="ariaLabel || t('App navigation')"
:class="{'app-navigation--close':!open }">
<AppNavigationToggle :open="open" @update:open="toggleNavigation" />
<AppNavigationToggle
:aria-label="toggleAriaLabel || t('App navigation toggle')"
:open="open"
@update:open="toggleNavigation" />
<slot />

<!-- List for Navigation li-items -->
Expand All @@ -85,6 +90,23 @@ export default {

mixins: [isMobile],

props: {
/**
* aria-label for the app navigation element
*/
ariaLabel: {
type: String,
default: '',
},
/**
* aria-label for the toggle button
*/
toggleAriaLabel: {
type: String,
default: '',
},
},

data() {
return {
open: true,
Expand Down

0 comments on commit 5d8e46c

Please sign in to comment.