From 3d425f54cc74361482b38f8434b2af8190a48cb8 Mon Sep 17 00:00:00 2001 From: David Wire Date: Wed, 17 Jul 2019 02:13:59 -0600 Subject: [PATCH] fix(ToolbarRow): Update ToolbarRow so that an activeButton in a submenu is passed in as an activeCom (#668) --- src/connectedComponents/ToolbarRow.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/connectedComponents/ToolbarRow.js b/src/connectedComponents/ToolbarRow.js index cf3de6b08..a1dd183d9 100644 --- a/src/connectedComponents/ToolbarRow.js +++ b/src/connectedComponents/ToolbarRow.js @@ -156,10 +156,17 @@ class ToolbarRow extends Component { */ function _getButtonComponents(toolbarButtons, activeButtons) { return toolbarButtons.map((button, index) => { + let activeCommand = undefined; + if (button.buttons && button.buttons.length) { // Iterate over button definitions and update `onClick` behavior const childButtons = button.buttons.map(childButton => { childButton.onClick = _handleToolbarButtonClick.bind(this, childButton); + + if (activeButtons.indexOf(childButton.id) > -1) { + activeCommand = childButton.id; + } + return childButton; }); @@ -169,6 +176,7 @@ function _getButtonComponents(toolbarButtons, activeButtons) { text={button.label} icon={button.icon} buttons={childButtons} + activeCommand={activeCommand} /> ); }