Skip to content

Commit

Permalink
provide an argument for the main header nav aria-label
Browse files Browse the repository at this point in the history
  • Loading branch information
Dietr committed Sep 5, 2024
1 parent ad9a376 commit d1d996f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion addon/components/au-main-header.gts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface AuMainHeaderSignature {
contactRoute?: string;
contactLabel?: string;
homeRoute?: string;
navigationAriaLabel?: string;
};
Blocks: {
default: [];
Expand All @@ -28,6 +29,11 @@ export default class AuMainHeader extends Component<AuMainHeaderSignature> {
else return 'Contacteer ons';
}

get navigationAriaLabel() {
if (this.args.navigationAriaLabel) return this.args.navigationAriaLabel;
else return 'Informatie en instellingen';
}

@action
headerLinkFocus() {
document.querySelector<HTMLElement>('#main')?.focus();
Expand Down Expand Up @@ -56,7 +62,7 @@ export default class AuMainHeader extends Component<AuMainHeaderSignature> {
</a>
</div>
<nav
aria-label="Informatie en instellingen"
aria-label="{{this.navigationAriaLabel}}"
class="au-c-main-header__actions"
>
<ul class="au-c-list-horizontal">
Expand Down
7 changes: 7 additions & 0 deletions stories/5-components/Brand/AuMainHeader.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export default {
description:
'Set the label for the contact link (default: Contacteer ons)',
},
navigationAriaLabel: {
control: 'text',
description:
'Set the aria-label for the navigation (default: Informatie en instellingen)',
},
},
parameters: {
layout: 'padded',
Expand All @@ -32,6 +37,7 @@ const Template = (args) => ({
@homeRoute={{this.homeRoute}}
@contactRoute={{this.contactRoute}}
@contactLabel={{this.contactLabel}}
@navigationAriaLabel={{this.navigationAriaLabel}}
>
<AuDropdown @title="Demo dropdown" @alignment="right" role="menu">
<AuButton @skin="link" @icon="logout" role="menuitem">
Expand All @@ -49,4 +55,5 @@ Component.args = {
homeRoute: 'home',
contactRoute: 'contact',
contactLabel: 'Contacteer ons',
navigationAriaLabel: 'Informatie en instellingen',
};

0 comments on commit d1d996f

Please sign in to comment.