Command button color styling overrides user color styles
Bug Report
- Package version(s): 4.25.1
Priorities and help requested (not applicable if asking question):
Are you willing to submit a PR to fix? Yes
Requested priority: Normal
Products/sites affected: VSTS
Describe the issue:
If the user adds color styling to the icon of a command button, the blue command button styling occasionally overrides it. Two styles are added with equal precedence and the user defined may be overridden.
Applied rules look similar to the following. The selectors have equal precedence:
.css-3sgmc7, [data-css-3sgmc7] { font-family: FabricMDL2Icons; font-weight: 400; font-style: normal; display: inline-block; color: rgb(0, 0, 0); // User defined }
.css-k686lf, [data-css-k686lf] { font-size: 16px; height: 16px; line-height: 16px; text-align: center; vertical-align: middle; color: rgb(0, 120, 215); // Office fabric defined margin: 0px 4px; }
Actual behavior:
Command button icon color does not always match user defined value
Expected behavior:
Command button icon color is user configurable and consistent
If applicable, please provide a codepen repro:
https://codepen.io/RegexEmpire/pen/mMBGwa/
VSTS Bug: 1056805: Favorites picker icon color setting flakey
The codepen seems reliable in choosing the correct style, but I think this may just be due to the simplicity of the content. You can still see the CSS styles with equal precedence which I don't think can be relied on.
<Fabric.CommandButton text='hello' iconProps={{ iconName: 'Upload', styles: { root: { color: '#000000' } } ❌ }} styles={ { icon: { color: 'red' } } } ✔️ />
Chatted with dzearing, it looks like I will want to use the button styles, not the icon props styles