-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(mat-icon): Font icon names are indexed by search engines #23195
Comments
Oh, this would also solve #23183 at the same time, since icons become CSS selectable (and thus customizable). |
I've used this workaround because a client wanted to copy a table's content into an excel sheet, and the icon's texts were pasted too. |
This solution seems reasonable to me. 👍 |
I believe that the text also has some accessibility implications. |
But only in english. |
I don't think there is any impact on accessibility, since mat-icon does not have any accessibility features, as stated in the docs:
@crisbeto, shall I create a new PR for this ? |
This also can help to acheive some sort of autocompletition in icon names. .ts:
template:
|
The new way to use ligature icons, via a dedicated attribute, allow to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusingto read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via a dedicated attribute, allow to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusingto read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via a dedicated attribute, allow to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusingto read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via a dedicated attribute, allows to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via a dedicated attribute, allows to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via a dedicated attribute, allows to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via a dedicated attribute, allows to hide the font name from search engine results. Otherwise the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>my-icon-name</mat-icon> + <mat-icon icon="my-icon-name"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via the `fontIcon` attribute, allows to hide the font name from search engine results. Otherwise, the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>home</mat-icon> + <mat-icon fontIcon="home"></mat-icon> ``` To also enable this for custom font, include the special `ligature-font` class when registering the font alias. So like this: ```ts iconRegistry.registerFontClassAlias('f1', 'font1 ligature-font'); ``` And use like this: ```html <mat-icon fontSet="f1" fontIcon="home"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via the `fontIcon` attribute, allows to hide the font name from search engine results. Otherwise, the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>home</mat-icon> + <mat-icon fontIcon="home"></mat-icon> ``` To also enable this for custom font, include the special `mat-ligature-font` class when registering the font alias. So like this: ```ts iconRegistry.registerFontClassAlias('f1', 'font1 mat-ligature-font'); ``` And use like this: ```html <mat-icon fontSet="f1" fontIcon="home"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via the `fontIcon` attribute, allows to hide the font name from search engine results. Otherwise, the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>home</mat-icon> + <mat-icon fontIcon="home"></mat-icon> ``` To also enable this for custom font, include the special `mat-ligature-font` class when registering the font alias. So like this: ```ts iconRegistry.registerFontClassAlias('f1', 'font1 mat-ligature-font'); ``` And use like this: ```html <mat-icon fontSet="f1" fontIcon="home"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via the `fontIcon` attribute, allows to hide the font name from search engine results. Otherwise, the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>home</mat-icon> + <mat-icon fontIcon="home"></mat-icon> ``` To also enable this for custom font, include the special `mat-ligature-font` class when registering the font alias. So like this: ```ts iconRegistry.registerFontClassAlias('f1', 'font1 mat-ligature-font'); ``` And use like this: ```html <mat-icon fontSet="f1" fontIcon="home"></mat-icon> ``` Fixes angular#23195 Fixes angular#23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via the `fontIcon` attribute, allows to hide the font name from search engine results. Otherwise, the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>home</mat-icon> + <mat-icon fontIcon="home"></mat-icon> ``` To also enable this for custom font, include the special `mat-ligature-font` class when registering the font alias. So like this: ```ts iconRegistry.registerFontClassAlias('f1', 'font1 mat-ligature-font'); ``` And use like this: ```html <mat-icon fontSet="f1" fontIcon="home"></mat-icon> ``` Fixes #23195 Fixes #23183 Fixes google/material-design-icons#498
The new way to use ligature icons, via the `fontIcon` attribute, allows to hide the font name from search engine results. Otherwise, the font name, which was never intended to be read by any end-users, would appear in the middle of legit sentences in search results, thus making the search result very confusing to read. New recommended usage is: ```diff - <mat-icon>home</mat-icon> + <mat-icon fontIcon="home"></mat-icon> ``` To also enable this for custom font, include the special `mat-ligature-font` class when registering the font alias. So like this: ```ts iconRegistry.registerFontClassAlias('f1', 'font1 mat-ligature-font'); ``` And use like this: ```html <mat-icon fontSet="f1" fontIcon="home"></mat-icon> ``` Fixes #23195 Fixes #23183 Fixes google/material-design-icons#498 (cherry picked from commit b37c96d)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Reproduction
https://stackblitz.com/edit/angular-gkwffm?file=src%2Fapp%2Ficon-overview-example.html
Steps to reproduce:
Expected Behavior
When I use a
<mat-icon>
I expected that the icon name is never indexed in search engine result. And that should be the case for all forms of<mat-icon>
.Actual Behavior
When I use the form
<mat-icon>home</mat-icon>
the texthome
will appear in search result pages (eg: on google.com), but this text has no value at all, and might even be counter-productive, because the icon name does not necessarily match the app specific semantic. More generally, the configuration of an Angular component should not end up on Google search results (or any other search engines).There is a related issue, google/material-design-icons#498, where a workaround is mentioned. It is to use the attribute
data-nosnippet
, as detailed in https://developers.google.com/search/docs/advanced/crawling/special-tags#data-nosnippet. But as far as I know, this only works for Google. And it must be used manually on every single usage of<mat-icon>
, which is error prone.Proposed Solution
I think we should have a more robust solution baked in
<mat-icon>
, as described in that issue, by using thee CSSattr()
function. So new usage would be something similar to:The only thing to change in
<mat-icon>
itself is to add the following CSS:This would make the API more consistent with all possible usages being:
From the accessibility point of view, and according to https://material.angular.io/components/icon/overview#accessibility, I don't think it would change anything.
And because we don't hardcode anything about the font in CSS, the CSS weight increase is minimal, and it does not have to be maintained when the font changes.
I would be willing to create a PR for this, as long as there is a chance to get merged. So would this be acceptable ?
Environment
The text was updated successfully, but these errors were encountered: