diff --git a/common/changes/office-ui-fabric-react/users-petdun-addReadonlyStateAndTooltipCommandBarItems_2018-03-13-21-28.json b/common/changes/office-ui-fabric-react/users-petdun-addReadonlyStateAndTooltipCommandBarItems_2018-03-13-21-28.json new file mode 100644 index 00000000000000..07220e45deeee0 --- /dev/null +++ b/common/changes/office-ui-fabric-react/users-petdun-addReadonlyStateAndTooltipCommandBarItems_2018-03-13-21-28.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "office-ui-fabric-react", + "comment": "CommandBar changed the title attribute to render as tooltip and added readonly state (visitable by keyboard, functionally disabled)", + "type": "minor" + } + ], + "packageName": "office-ui-fabric-react", + "email": "peterdunlop2519@gmail.com" +} \ No newline at end of file diff --git a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.scss b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.scss index b7866ce88a0c88..2f4f6d4a9c1f4c 100644 --- a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.scss +++ b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.scss @@ -172,6 +172,15 @@ $SearchBox-sidePadding: 8px; // padding in input on left and right sides without &.itemLinkIsExpanded:hover { background-color: $ms-color-neutralQuaternary; } + + &.inactive { + color: $ms-color-neutralTertiaryAlt; + cursor: default; + pointer-events: none; + .itemIcon { + color: $ms-color-neutralTertiaryAlt; + } + } } .itemIcon { diff --git a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx index c33eb4feb7c31e..a97e0a40ca28ce 100644 --- a/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx +++ b/packages/office-ui-fabric-react/src/components/CommandBar/CommandBar.tsx @@ -188,8 +188,16 @@ export class CommandBar extends BaseComponent ); + } else if (tooltipContent) { + command = ( + + { command } + + ); } return ( @@ -399,6 +419,10 @@ export class CommandBar extends BaseComponent) => void { return (ev: React.MouseEvent): void => { + if (item.inactive) { + return; + } + if (item.key === this.state.expandedMenuItemKey || !hasSubmenu(item)) { this._onContextMenuDismiss(); } else { diff --git a/packages/office-ui-fabric-react/src/components/CommandBar/__snapshots__/CommandBar.test.tsx.snap b/packages/office-ui-fabric-react/src/components/CommandBar/__snapshots__/CommandBar.test.tsx.snap index 89282c08b05c9f..cdfa05f114431b 100644 --- a/packages/office-ui-fabric-react/src/components/CommandBar/__snapshots__/CommandBar.test.tsx.snap +++ b/packages/office-ui-fabric-react/src/components/CommandBar/__snapshots__/CommandBar.test.tsx.snap @@ -21,6 +21,7 @@ exports[`CommandBar renders CommandBar correctly 1`] = ` className="ms-CommandBarItem" >