Skip to content

Commit

Permalink
feat: close dropdown menu when a label is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Morse committed Oct 22, 2019
1 parent bc40711 commit 59c2953
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/components/bolt-tabs/src/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ class BoltTabs extends withContext(withLitHtml()) {
const listClasses = cx('c-bolt-tabs__nav', {});
const panelsClasses = cx('c-bolt-tabs__panels-container');

const handleLabelClick = (e, index) => {
this.setSelectedTab(index);
this.menuIsOpen && this.closeDropdown();
};

const tabButtons = isDropdown => {
let buttons = [];

Expand Down Expand Up @@ -286,7 +291,7 @@ class BoltTabs extends withContext(withLitHtml()) {
aria-controls="${panelId}"
id="${labelId}"
tabindex="${isSelected ? 0 : -1}"
@click=${e => this.setSelectedTab(index)}
@click=${e => handleLabelClick(e, index)}
@keydown=${e => this.handleOnKeydown(e)}
@keyup=${e => this.handleOnKeyup(e)}
>
Expand Down

0 comments on commit 59c2953

Please sign in to comment.