Skip to content

Commit

Permalink
fix management side nav accessibility (#51507) (#51537)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkime authored Nov 23, 2019
1 parent 69e0b61 commit d03a43b
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions src/legacy/ui/public/management/components/sidebar_nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { EuiIcon, EuiSideNav, IconType } from '@elastic/eui';
import { EuiIcon, EuiSideNav, IconType, EuiScreenReaderOnly } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import React from 'react';
Expand Down Expand Up @@ -72,17 +72,26 @@ export class SidebarNav extends React.Component<SidebarNavProps, SidebarNavState
}

public render() {
const HEADER_ID = 'management-nav-header';

return (
<EuiSideNav
aria-label={i18n.translate('common.ui.management.nav.label', {
defaultMessage: 'Management',
})}
mobileTitle={this.renderMobileTitle()}
isOpenOnMobile={this.state.isSideNavOpenOnMobile}
toggleOpenOnMobile={this.toggleOpenOnMobile}
items={sideNavItems(this.props.sections, this.props.selectedId)}
className="mgtSideBarNav"
/>
<>
<EuiScreenReaderOnly>
<h2 id={HEADER_ID}>
{i18n.translate('common.ui.management.nav.label', {
defaultMessage: 'Management',
})}
</h2>
</EuiScreenReaderOnly>
<EuiSideNav
aria-labelledby={HEADER_ID}
mobileTitle={this.renderMobileTitle()}
isOpenOnMobile={this.state.isSideNavOpenOnMobile}
toggleOpenOnMobile={this.toggleOpenOnMobile}
items={sideNavItems(this.props.sections, this.props.selectedId)}
className="mgtSideBarNav"
/>
</>
);
}

Expand Down

0 comments on commit d03a43b

Please sign in to comment.