Skip to content
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

Fix Material Icons by migrating to Material Symbols. #1404

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

richardxia
Copy link
Member

Something appears to have changed about the Material Icons icon font that we're loading from Google Fonts, which is making them render strangely. Most severely is that on iOS, the width of the element containing the icons is 1,000,000 pixels wide, which not only stretches the page but also blocks click events from going through, even though the element itself is transparent. On desktop and Android, we do not see the extremely wide icons, but it appears that the icons are noticeably smaller than they used to be.

Several years ago, Google released Material Symbols as a successor to Material Icons. Switching our app to Material Symbols appears to get rid of the issues described above.

Note that there are slight differences in the icons after this change. Most of the differences are due to icons changing from being outlined (no fill) to filled with a solid color. Material Icons had separate icon names for any icons with different fill vs. outlined variants, but Material Symbols controls this with the font URL query and the font-variant-settings CSS property. This means that when migrating from Material Icons, any icons with names like foo_outline must be renamed to foo. We don't bother with loading both the outlined and filled variations of the font, so we've instead migrated several icons to the filled variant.


I tested this on desktop as well as an iOS simulator (I own a Macbook but not an iPhone, so I have to use a simulator), and I can confirm that on iOS, we don't experience the bug where various links don't work (due to be covered up by the insanely wide elements). On Desktop, on Chrome, I made sure to visit every single instance of a Material Icon/Symbol on our app to make sure they all render fine. I also tested a bit on Firefox and Safari, though not comprehensively.

Finally, here are a few screenshots demonstrating the before and after on desktop Chrome:

Before (Edit Phone)

Screenshot 2024-12-31 at 4 02 49 PM

After (Edit Phone)

Screenshot 2024-12-31 at 4 02 45 PM

Before (Add Service)

Screenshot 2024-12-31 at 4 02 58 PM

After (Add Service)

Screenshot 2024-12-31 at 4 02 54 PM

Before (News Banner)

Screenshot 2024-12-31 at 4 03 12 PM

After (News Banner)

Screenshot 2024-12-31 at 4 03 08 PM

Before (Map Directions)

Screenshot 2024-12-31 at 4 03 36 PM

After (Map Directions)

Screenshot 2024-12-31 at 4 03 42 PM

Before (Add Bookmark)

Screenshot 2024-12-31 at 4 04 09 PM

After (Add Bookmark)

Screenshot 2024-12-31 at 4 03 56 PM

Something appears to have changed about the Material Icons icon font
that we're loading from Google Fonts, which is making them render
strangely. Most severely is that on iOS, the width of the element
containing the icons is 1,000,000 pixels wide, which not only stretches
the page but also blocks click events from going through, even though
the element itself is transparent. On desktop and Android, we do not see
the extremely wide icons, but it appears that the icons are noticeably
smaller than they used to be.

Several years ago, Google released Material Symbols as a successor to
Material Icons. Switching our app to Material Symbols appears to get rid
of the issues described above.

Note that there are slight differences in the icons after this change.
Most of the differences are due to icons changing from being outlined
(no fill) to filled with a solid color. Material Icons had separate icon
names for any icons with different fill vs. outlined variants, but
Material Symbols controls this with the font URL query and the
`font-variant-settings` CSS property. This means that when migrating
from Material Icons, any icons with names like `foo_outline` must be
renamed to `foo`. We don't bother with loading both the outlined and
filled variations of the font, so we've instead migrated several icons
to the filled variant.
@richardxia richardxia merged commit e6eb003 into master Jan 9, 2025
5 checks passed
@richardxia richardxia deleted the fix-material-icon-ios-18-bug branch January 9, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants