@@ -124,16 +124,26 @@ const ribbonOverflowButtonRootStyles = (theme: Theme): IStyle => {
124124 } ;
125125} ;
126126
127- const ribbonButtonRootStyles = ( theme : Theme ) : IStyle => {
127+ const ribbonButtonRootStyles = ( iconColor : string , hoverIconColor : string ) : IStyle => {
128128 return {
129129 backgroundColor : 'transparent' ,
130130 selectors : {
131- // Icon's color doesn't work here because of the specificity
131+ // media query applies only if the device allows real hover interactions
132+ // and hover styles are not applied on touch- only devices where the hover state cannot be accurately detected
133+ '@media (hover: hover)' : {
134+ ':hover .ms-Button-icon' : {
135+ color : hoverIconColor
136+ } ,
137+ ':hover .ms-Button-menuIcon' : {
138+ color : hoverIconColor
139+ }
140+ } ,
141+ // the classes needs here to apply to styles for icons because of the specificity
132142 '.ms-Button-icon' : {
133- color : theme . palette . themePrimary
143+ color : iconColor
134144 } ,
135145 '.ms-Button-menuIcon' : {
136- color : theme . palette . themePrimary
146+ color : iconColor
137147 }
138148 }
139149 } ;
@@ -147,13 +157,14 @@ export const toolbarButtonStyle = (theme: Theme): Partial<IButtonStyles> => {
147157 icon : { color : theme . palette . neutralPrimary , height : 'auto' } ,
148158 menuIcon : { color : theme . palette . neutralPrimary , height : 'auto' } ,
149159 root : { minWidth : 'auto' , backgroundColor : 'transparent' } ,
150- rootChecked : ribbonButtonRootStyles ( theme ) ,
151- rootHovered : ribbonButtonRootStyles ( theme ) ,
152- rootCheckedHovered : ribbonButtonRootStyles ( theme ) ,
153- rootCheckedPressed : ribbonButtonRootStyles ( theme ) ,
154- rootPressed : ribbonButtonRootStyles ( theme ) ,
155- rootExpanded : ribbonButtonRootStyles ( theme ) ,
156- rootExpandedHovered : ribbonButtonRootStyles ( theme )
160+ rootChecked : ribbonButtonRootStyles ( theme . palette . themePrimary , theme . palette . themePrimary ) ,
161+ // there is a bug for Android where the press action is considered hover sometimes
162+ rootHovered : ribbonButtonRootStyles ( theme . palette . neutralPrimary , theme . palette . themePrimary ) ,
163+ rootCheckedHovered : ribbonButtonRootStyles ( theme . palette . themePrimary , theme . palette . themePrimary ) ,
164+ rootCheckedPressed : ribbonButtonRootStyles ( theme . palette . themePrimary , theme . palette . themePrimary ) ,
165+ rootPressed : ribbonButtonRootStyles ( theme . palette . themePrimary , theme . palette . themePrimary ) ,
166+ rootExpanded : ribbonButtonRootStyles ( theme . palette . themePrimary , theme . palette . themePrimary ) ,
167+ rootExpandedHovered : ribbonButtonRootStyles ( theme . palette . themePrimary , theme . palette . themePrimary )
157168 } ;
158169} ;
159170
0 commit comments