swisnl / jQuery-contextMenu

jQuery contextMenu plugin & polyfill
https://swisnl.github.io/jQuery-contextMenu/
MIT License
2.24k stars 744 forks source link

no font-awesome icons visible in submenu [fix included] #659

Closed betafritz closed 5 years ago

betafritz commented 6 years ago

I´m using font-awesome icons in my contextmenus. when you hover the item that has the submenu as child, the icon-color changes to white (#fff). that´s because you than can see the top item icon even when its has now the hover color. But that also changes the items color in the submenu to white so they are not visible. contextmenu

so to fix that you must enter a ">" in the css rule (line 171 in jquery.contextMenu.css v2.7.0):

.context-menu-icon.context-menu-icon--fa5.context-menu-hover > i,.context-menu-icon.context-menu-icon--fa5.context-menu-hover svg {

    color: #fff

}

I haven´t check on the svg item. but i guess there should be a > too.

bbrala commented 6 years ago

When i try to reproduce this i see the icons without a problem, with the SVG and CSS version of font-awesome 5. What browser are you using?

EddieAguirre commented 5 years ago

I'm having a similar or the same issue. In my case the icons in the submenu appear as expected until I add an icon to the submenu selector (the item that displays the submenu).

Below is the output when the submenu selector item doesn't have an icon. screen shot 2018-09-11 at 12 13 52 pm

Below is after adding the submenu selector icon, the submenu icons disappear. screen shot 2018-09-11 at 12 14 16 pm

And the same as above while hovering over a submenu item. You can see the icon is there it just doesn't show until hovered. screen shot 2018-09-11 at 12 14 22 pm

I'm using Font Awesome as well.

var tmpItems = { "Hello": { "name": "Hello", "icon": "fas fa-columns", }, "fold1": { "name": "Columns", "icon": "fas fa-columns", "items": tmpColumnItems, }, };

klues commented 5 years ago

had the same problem. in jquery.contextMenu.css just instead this:

.context-menu-icon.context-menu-icon--fa5.context-menu-hover i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover svg {
  color: #fff;
}

use:

.context-menu-icon.context-menu-icon--fa5.context-menu-hover > i, .context-menu-icon.context-menu-icon--fa5.context-menu-hover > svg {
  color: #fff;
}

So the > only applies to direct childs and makes the icon white for them (because background of selected items is blue). Other childs remain unaffected and the icons remain blue.

looks like this in my project: http://prntscr.com/l17i3g

klues commented 5 years ago

for fixing the issue for release the SASS rule in https://github.com/swisnl/jQuery-contextMenu/blob/master/src/sass/jquery.contextMenu.scss#L62 would have to be changed so that only direct childs are affected.

klues commented 5 years ago

oh, sorry, did not see that @betafritz also proposed the solution... only saw that the issue is still open.

bbrala commented 5 years ago

Sorry for the delay, a fix has been published.