Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Nav component sets aria-label on nested element with role=navigation",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "shiran.pasternak@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class NavBase extends BaseComponent<INavProps, INavState> implements INav
<nav
role='navigation'
className={ classNames.root }
aria-label={ this.props.ariaLabel }
>
{ groupElements }
</nav>
Expand Down Expand Up @@ -218,7 +219,7 @@ export class NavBase extends BaseComponent<INavProps, INavState> implements INav
const classNames = getClassNames(getStyles!, { theme: theme!, groups });

return (
<ul role='list' aria-label={ this.props.ariaLabel } className={ classNames.navItems }>
<ul role='list' className={ classNames.navItems }>
{ linkElements }
</ul>
);
Expand Down
10 changes: 10 additions & 0 deletions packages/office-ui-fabric-react/src/components/Nav/Nav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@ describe('Nav', () => {
link.simulate('click');
expect(handler.mock.calls.length).toBe(1);
});

it('sets ARIA label on the nav element', () => {
const label = 'The navigation label';
const nav = mount<NavBase>(
<Nav
ariaLabel={ label }
groups={ [] }
/>);
expect(nav.find('[role="navigation"]').prop('aria-label')).toEqual(label);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exports[`Nav renders Nav correctly 1`] = `
role="presentation"
>
<nav
aria-label={undefined}
className=
ms-Nav
{
Expand Down Expand Up @@ -40,7 +41,6 @@ exports[`Nav renders Nav correctly 1`] = `
}
>
<ul
aria-label={undefined}
className=
ms-Nav-navItems
{
Expand Down