Skip to content

Commit

Permalink
feat(ui-shell): close side-nav when click on the overlay (carbon-desi…
Browse files Browse the repository at this point in the history
  • Loading branch information
abdonrd authored Aug 1, 2023
1 parent 3ab77f5 commit 9b0d16a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ class CDSSideNav extends HostListenerMixin(LitElement) {
}
}

/**
* Handles the `click` event for the side nav overlay.
*
*/
private _onOverlayClick() {
this.expanded = false;
}

render() {
const { collapseMode, expanded, isNotChildOfHeader, isNotPersistent } =
this;
Expand All @@ -273,7 +281,9 @@ class CDSSideNav extends HostListenerMixin(LitElement) {
});
return html`${this.collapseMode === SIDE_NAV_COLLAPSE_MODE.FIXED
? null
: html`<div class="${overlayClasses}"></div>`}
: html`<div
class="${overlayClasses}"
@click=${this._onOverlayClick}></div>`}
<div
class="${classes}"
@mouseover="${this._handleNavMouseOver}"
Expand Down

0 comments on commit 9b0d16a

Please sign in to comment.