angular / components

Component infrastructure and Material Design components for Angular
https://material.angular.io
MIT License
24.23k stars 6.7k forks source link

Problems occuring due to #25779 fontIcon-attribute #25862

Closed MilesAl closed 1 year ago

MilesAl commented 1 year ago

What are you trying to do?

Currently, the fonticon attribute is set on the dom element, but not as mentioned in #25759 (in version 13) also a class with the same name of the font-icon. Previously in our project we set a class (with the font-family and other styles to the font) on the dom element by checking via css if the DOM element has a class with the name of the font-icon. This is no longer possible.

What troubleshooting steps have you tried?

Alternatively, you would have to refer to a separate font set everywhere, which could lead to greater effort. E.g. if a component contains a mat-icon which allows a ligature of e.g. font-awsome as well as a fonticon which needs another fontSet. Then you would have to check separately in each of these components which icon type is set. Previously this could be overridden by css according to the above mentioned principle. How do you foresee the whole thing, is still setting the class of the same name (as in v13) integrated again or is now always an explicit specification within the template necessary when using multiple IconSets in parallel?

Reproduction

Steps to reproduce:

  1. Set fontIcon on any matIcon-element
  2. Try to set class by css-selecting all elements which contain class with name of fontIcon

Environment

mmalerba commented 1 year ago

I don't fully understand the problem being described here, but if you're trying to target styles at a particular font icon, you should be able to do that using an attribute selector instead of a font selector:

mat-icon[fonticon="my-icon"] {
  // custom styles here
}
angular-automatic-lock-bot[bot] commented 1 year ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.