diff --git a/CHANGELOG.md b/CHANGELOG.md index 707ecd5a4d4..66d0c2fee3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ - Converted `EuiHighlight` to Typescript ([#2681](https://github.com/elastic/eui/pull/2681)) +**Bug fixes** + +- Reverted removal of `toggleOpen` method from `EuiNavDrawer` ([#2682](https://github.com/elastic/eui/pull/2682)) + ## [`17.2.1`](https://github.com/elastic/eui/tree/v17.2.1) **Bug fixes** diff --git a/src/components/nav_drawer/nav_drawer.js b/src/components/nav_drawer/nav_drawer.js index 848d1fd8436..c8da6de6dfd 100644 --- a/src/components/nav_drawer/nav_drawer.js +++ b/src/components/nav_drawer/nav_drawer.js @@ -66,6 +66,22 @@ export class EuiNavDrawer extends Component { }); }; + // Although not used in `src/`, this method is available to and used in `src-docs/` + // for implementation-specific nav menu toggling via `ref` reference + toggleOpen = () => { + this.setState( + ({ isCollapsed }) => ({ + isCollapsed: !isCollapsed, + }), + () => { + this.setState(({ isCollapsed }) => ({ + outsideClickDisabled: isCollapsed, + toolTipsEnabled: isCollapsed, + })); + } + ); + }; + collapseButtonClick = () => { if (this.state.isCollapsed) { this.expandDrawer();