diff --git a/CHANGELOG.md b/CHANGELOG.md index 298710f9ff7..37dd62474da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Added `component` prop to `EuiPageBody`, switching the default from `div` to `main` ([#2410](https://github.com/elastic/eui/pull/2410)) - Added focus state to `EuiListGroupItem` ([#2406](https://github.com/elastic/eui/pull/2406)) - Added `keyboardShorcut` glyph to 'EuiIcon ([#2413](https://github.com/elastic/eui/pull/2413)) +- Improved a11y in `EuiNavDrawer` ([#2417](https://github.com/elastic/eui/pull/2417)) **Bug fixes** diff --git a/src-docs/src/views/nav_drawer/nav_drawer.js b/src-docs/src/views/nav_drawer/nav_drawer.js index 04df1470330..29a81960b07 100644 --- a/src-docs/src/views/nav_drawer/nav_drawer.js +++ b/src-docs/src/views/nav_drawer/nav_drawer.js @@ -50,7 +50,11 @@ export default class extends Component { color: 'subdued', iconType: 'pin', iconSize: 's', - 'aria-label': 'Pin to top', + }; + + const pinExtraActionFn = val => { + pinExtraAction['aria-label'] = `Pin ${val} to top`; + return pinExtraAction; }; this.topLinks = [ @@ -124,7 +128,7 @@ export default class extends Component { iconType: 'canvasApp', isActive: true, extraAction: { - ...pinExtraAction, + ...pinExtraActionFn('Canvas'), alwaysShow: true, }, }, @@ -132,35 +136,35 @@ export default class extends Component { label: 'Discover', href: '#/layout/nav-drawer', iconType: 'discoverApp', - extraAction: pinExtraAction, + extraAction: { ...pinExtraActionFn('Discover') }, }, { label: 'Visualize', href: '#/layout/nav-drawer', iconType: 'visualizeApp', - extraAction: pinExtraAction, + extraAction: { ...pinExtraActionFn('Visualize') }, }, { label: 'Dashboard', href: '#/layout/nav-drawer', iconType: 'dashboardApp', - extraAction: pinExtraAction, + extraAction: { ...pinExtraActionFn('Dashboard') }, }, { label: 'Machine learning', href: '#/layout/nav-drawer', iconType: 'machineLearningApp', - extraAction: pinExtraAction, + extraAction: { ...pinExtraActionFn('Machine learning') }, }, { label: 'Custom Plugin (no icon)', href: '#/layout/nav-drawer', - extraAction: pinExtraAction, + extraAction: { ...pinExtraActionFn('Custom Plugin') }, }, { label: 'Nature Plugin (image as icon)', href: '#/layout/nav-drawer', - extraAction: pinExtraAction, + extraAction: { ...pinExtraActionFn('Nature Plugin') }, icon: ( + this.closeBoth()} isDisabled={this.state.outsideClickDisabled}> -
- - - - - {flyoutContent} -
+ ); }