craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.25k stars 631 forks source link

[3.x]: Multiple icons missing in CP #11619

Open proimage opened 2 years ago

proimage commented 2 years ago

What happened?

Description

Recently (I wish I could point to a specific update but I cannot), I've noticed that multiple icons are missing from the Craft CP (EDIT: in Chrome Version 103.0.5060.114 (Official Build) (64-bit)):

image

At first I thought it was all first-party icons in the main menu, but then I saw that GraphQL was still intact. Here's the rendered source from devtools of the GraphQL and Utilities menu items:

image

I have cleared the Control panel resources cache, to no effect. There are no errors in the console.

EDIT: Additional findings... this is not happening in Firefox. It does happen in a Chrome Incognito window.

Steps to reproduce

  1. No idea... it just is.

Expected behavior

I'd expect all the usual icons to show up.

Actual behavior

The SVG for many icons isn't being included/rendered/injected into the source code.

Craft CMS version

3.7.43

PHP version

7.4.3

Operating system and version

Windows 11 Version 21H2 (OS Build 22000.795)

Database type and version

MySQL 5.6.47.0

Image driver and version

Imagick 3.4.4 (ImageMagick 6.9.10-23)

Installed plugins and versions

brandonkelly commented 2 years ago

A couple people have reported this in Discord as well, but we haven’t been able to get to the bottom of it. It appears to be something to do with a recent update to Chrome, however we are unable to reproduce it ourselves using the same version.

proimage commented 2 years ago

Hmm. I'd love to do what I can to troubleshoot this; I am encountering this problem across all the Craft 3 sites I manage. FWIW, it doesn't seem to happen on a Craft 2.9.2 site I have access to.

I've disabled the three Chrome extensions I had that were allowed in Incognito mode, but it didn't make any difference.

It seems telling to me that the svg code itself is missing from the compiled source view in devtools. I take it the SVGs are getting inserted via JS for some reason, rather than by Twig?

stephanwergles commented 2 years ago

For me, this error has also been occurring recently. My feeling is that it happened shortly after an update of Chrome and that across different installations. I can also confirm that the error occurs in the incognito window, Firefox and all other browsers have no problems. In my case, the console does not show any traceable errors either.

watarutmnh commented 2 years ago

The same issue here with Chrome Version 103.0.5060.134, but no issue with Chrome Canary Version 105.0.5190.0. Both are the latest version.

thupsi commented 2 years ago

Can confirm this is an issue also in Craft 4, in Chrome 103.0.5060.134, Windows 11

thupsi commented 2 years ago

It's pretty weird. When I manually add the below css to the inspector stylesheet it works as expected:

.sidebar nav li a .icon span[data-icon]:before {
    display: block;
}

[data-icon]:before {
    content: attr(data-icon);
}

#help:before, .element:before, .go:after, .icon:before, .insecure:before, .menu .flex.padded.sel:before, .menu ul.padded li a.sel:before, .preview-btn:before, .required:after, .secure:before, .texticon:before, .view-btn:before, [data-icon-after]:after, [data-icon]:before {
    speak: none;
    -webkit-font-feature-settings: "liga","dlig";
    -ms-font-feature-settings: "liga","dlig";
    -o-font-feature-settings: "liga","dlig";
    font-feature-settings: "liga","dlig";
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-wrap: normal!important;
    direction: ltr;
    display: inline-block;
    font-family: Craft;
    font-style: normal;
    font-variant: normal;
    font-weight: 400;
    line-height: 1;
    opacity: var(--icon-opacity);
    text-align: center;
    text-transform: none;
    -webkit-user-select: none;
    user-select: none;
    vertical-align: middle;
}

but

If I open the cp.css file via the dev tools and add the same rules, it doesn't work.

but still

If I open the cp.css file via the dev tools and add the same rules with this selector .sidebar nav li a .icon span:before, (notice the missing [data-icon]) it works!

So...

Maybe the data-icon attribute is later injected in the html (after loading cp.css) and the renderer is somehow tripped up? I don't even know if that is possible, but something is happening.

Edit: The more I think about it, my above explanation seems implausible, still my observations about the css selector should be a clue to the actual root cause.

Edit 2: Also tried Dev and Canary channels with no plugins installed, same issue.

thupsi commented 2 years ago

The same issue here with Chrome Version 103.0.5060.134, but no issue with Chrome Canary Version 105.0.5190.0. Both are the latest version.

Sadly, Chrome Canary 105.0.5191.0 doesn't work for me.

thupsi commented 2 years ago

Yet another update: I can't reproduce the issue on my laptop (up to now I was testing on my desktop), running the exact same version of Windows, Chrome, Craft etc. Hmm, very weird.

proimage commented 2 years ago

I think the first thing we need to figure out is how those <svg> icons end up on the page: are they injected by Javascript, or does Twig build the page with them as part of the source code?

twitcher07 commented 2 years ago

I can confirm this is happening to me in Chrome Version 103.0.5060.114. This Craft sidebar looks like this for me: image

In Firefox version 102.0.1 the icons seem to be working just fine: image

My Craft version is 3.7.30.1.

thupsi commented 2 years ago

I think the first thing we need to figure out is how those <svg> icons end up on the page: are they injected by Javascript, or does Twig build the page with them as part of the source code?

The template file is this: https://github.com/craftcms/cms/blob/75d999d9a5d5351186d02a6a8286f89ae4c035b3/src/templates/_layouts/components/global-sidebar.twig

At about line 31 you can see that the icon is either an <svg>, or a font icon. In our case the SVGs (for example thr GraphQL icon) are displaying correctly, but the font icons are not.

thupsi commented 2 years ago

OK, so, investigating further, try this: Open cp.css via devtools and add this line at the end of the file:

[data-icon="section"]{ }

As you can see, it's just an empty rule, referencing the data-icon attribute of the entries nav item.

Result:

image

That's crazy! It's like the browser doesn't match elements with the [data-icon] attribute selector unless you include even an empty rule with a value match, like [data-icon=value]. I don't know if it's JS related, but it keeps getting weirder 🙃

proimage commented 2 years ago

Ok, you wanna see something even weirder? It seems like whatever the value is of that [data-icon="..."] selector is, is treated as a wildcard. So it fixes the icons for anything containing the letter(s) specified. I tried with the most common letters, vowels:

[data-icon="a"]: image

[data-icon="e"]: image

[data-icon="i"]: image

...etc.

This bug is almost as perplexing as that time ~15+ years ago when I was building my brother's PC for him, and powered the thing on, only to hear absolutely nothing... no case fans, no CPU fan, no HDD spinning, and no PSU fan... nothing was physically moving. And yet somehow, it POSTed! 🤪

turnstylerj commented 2 years ago

Super weird, I just noticed this after updating to Chrome 103.0.5060.134. Happening on multiple sites I'm sure were showing all the icons prior to today with the same version of Craft/plugins. Happening on both Craft 3 and Craft 4 sites on my end, and only in Chrome.

proimage commented 2 years ago

Font icons are no longer best practice these days (were they ever?), so perhaps at the very least this should be seen as a reason to switch to SVGs across the board in Craft? @brandonkelly

alexr8 commented 2 years ago

One additional annoying part of this bug is the blue globe icons don't show up in the entries table view, so you can't open an entry on the front end without going into the entry (or checking it and using the dropdown view entry). these icons:

image

Can also confirm its happening on craft 3 and 4 sites for me, only in chrome (MacOS), currently v103.0.5060.134 but it happened on the previous version i had too before updating.

bymayo commented 2 years ago

Yeah we're also experiencing this issue, it looks specific to Chrome Version 103.0.5060.134 (Official Build) (arm64)

Plugin icons load fine, it's just Craft's own icons (Entries, Utilities etc) that don't load.

Affects Craft 3 & Craft 4

croxton commented 2 years ago

Also seeing this bug and it affects all versions of Craft 3 that I've tried, unfortunately.

Chrome Version 103.0.5060.134 (Official Build) (arm64)

I've also seen some hints of odd behaviour with CSS generally when hard refreshing various webpages in this latest version of Chrome - very occasionally, CSS styles don't get applied or only some styles. Which is troubling!

croxton commented 2 years ago

Quick workaround:

Install the Control Panel CSS plugin for Craft CMS: https://github.com/doublesecretagency/craft-cpcss

Craft 4: composer require doublesecretagency/craft-cpcss

Craft 3: composer require doublesecretagency/craft-cpcss:2.4

Install the plugin, go to it's settings and paste in this CSS to restore all your icons:

[data-icon]::before {
    content: attr(data-icon);
}
.icon::before, .menu ul.padded li a.sel::before, .menu .flex.padded.sel::before, .texticon::before, .element::before, #help::before, .secure::before, .insecure::before, .go::after, .required::after, #preview-btn::before, #share-btn::before, [data-icon]::before, [data-icon-after]::after {
    font-family: "Craft";
    speak: none;
    -webkit-font-feature-settings: "liga","dlig";
    -ms-font-feature-settings: "liga","dlig";
    -o-font-feature-settings: "liga","dlig";
    font-feature-settings: "liga","dlig";
    text-rendering: optimizeLegibility;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: inline-block;
    text-align: center;
    font-style: normal;
    vertical-align: middle;
    word-wrap: normal !important;
    -webkit-user-select: none;
    user-select: none;
    opacity: .8;
}
body.ltr .meta > .field > .input > .datewrapper .text + div[data-icon], body.ltr .meta > .field > .input > .timewrapper .text + div[data-icon], body.ltr .meta > .field > .input > .datetimewrapper > .datewrapper .text + div[data-icon], body.ltr .meta > .field > .input > .datetimewrapper > .timewrapper .text + div[data-icon], body.ltr .meta > .flex-fields > .field > .input > .datewrapper .text + div[data-icon], body.ltr .meta > .flex-fields > .field > .input > .timewrapper .text + div[data-icon], body.ltr .meta > .flex-fields > .field > .input > .datetimewrapper > .datewrapper .text + div[data-icon], body.ltr .meta > .flex-fields > .field > .input > .datetimewrapper > .timewrapper .text + div[data-icon] {
    left: 0;
}
.datewrapper .text:placeholder-shown + div[data-icon], .datewrapper .text:placeholder-shown + div[data-icon]::before, .datewrapper .text.empty-value + div[data-icon], .datewrapper .text.empty-value + div[data-icon]::before, .timewrapper .text:placeholder-shown + div[data-icon], .timewrapper .text:placeholder-shown + div[data-icon]::before, .timewrapper .text.empty-value + div[data-icon], .timewrapper .text.empty-value + div[data-icon]::before {
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
    z-index: 1;
}
.datewrapper .text:placeholder-shown + div[data-icon], .datewrapper .text.empty-value + div[data-icon], .timewrapper .text:placeholder-shown + div[data-icon], .timewrapper .text.empty-value + div[data-icon] {
    display: block;
    position: absolute;
    top: calc(50% - 12px);
    z-index: 0;
    color: #606d7b;
}
.datewrapper .text + div[data-icon], .timewrapper .text + div[data-icon] {
    display: none;
}
.sidebar nav li a .icon span[data-icon] {
    font-size: 16px;
}
croxton commented 2 years ago

Note that the bug appears to be that Chrome does not apply any rules that contain [data-icon] in cp.css.

Update: icons are working for me in latest Canary: Version 105.0.5195.0 (Official Build) canary (arm64)

digason commented 2 years ago

Icons are not showing in the latest Chromium dev build: Version 106.0.5196.0 (Developer Build) (x86_64)

I suspect this issue will show up on other Chromium based browsers at some point, like Edge and Opera.

mmikkel commented 2 years ago

FWIW, I'm not able to reproduce (i.e. icons are visible) on Chrome 103.0.5060.134 (Official Build) (arm64) on macOS 12.4.

proimage commented 2 years ago

FWIW, I'm not able to reproduce (i.e. icons are visible) on Chrome 103.0.5060.134 (Official Build) (arm64) on macOS 12.4.

Could you try under Windows (using browserstack or parallels or whatever)? Perhaps it's a Chrome + Windows issue.

mmikkel commented 2 years ago

FWIW, I'm not able to reproduce (i.e. icons are visible) on Chrome 103.0.5060.134 (Official Build) (arm64) on macOS 12.4.

Could you try under Windows (using browserstack or parallels or whatever)? Perhaps it's a Chrome + Windows issue.

The issue has already been seen on Mac, so that doesn’t seem to be the case. The problem seems more complicated than just a platform/version thing; maybe it’s something to do w/ Chrome configuration settings (perhaps some specific combination of security options or the like?)

adrianjean commented 2 years ago

I too am seeing this — on nearly every CraftCMS site I update to the latest version. I also notices other icons are missing on other system pages like down arrows and such. Works in Safari, works in FireFox — so odd.

Platform: MacOS 12.4 (21F79) Browser: Chrome - 103.0.5060.134 (Official Build) (arm64) Craft: Craft CMS 3.7.48 Pro

Plugins Installed (All up to date): AsyncQueue Button Box Control Panel CSS (I tested without this as well) Control Panel Nav (I tested without this as well) Dashboard Begone Eager Beaver Enupal Backup Expanded Singles Formie Freeform Knock Knock Redactor Redactor Anchors Redactor Custom Styles Retour SEOmatic SendGrid Sprig Super Table

turnstylerj commented 2 years ago

Screen Shot 2022-07-24 at 2 26 47 PM

I just realized I'm also missing the field handle icons and translatable field icons in settings, as well as the translatable field icons in entry views for authors, which feels like a much bigger deal.

Also on macOS v12.2.1.

croxton commented 2 years ago

Not sure how this helps but I've discovered that you can have a maximum of ~44 individual CSS rules in cp.css that reference [data-icon]. Any more and the icons disappear. It is the number of rules rather than anything specific about them that matters.

It would suggest that Chrome has a maximum quota for the number of matches for a given selector in a single stylesheet.

croxton commented 2 years ago

Resetting Chrome restored the icons for me, on Version 103.0.5060.134 (Official Build) (arm64)

Go to chrome://settings/ and click Reset settings from the menu.

alexr8 commented 2 years ago

As far as i know I've not changed anything (in terms of updating chrome, resetting settings, changing craft versions or updating my OS in any way), and my icons seem to appearing now just fine (questioning my sanity at this point 😅). Anyone else?

iamtompickering commented 2 years ago

@alexr8 same thing has happened to me today!

I've not touched anything on my machine and suddenly everything is back to normal.

I've not updated Chrome, and it is running Version 103.0.5060.134 (Official Build) (arm64)

croxton commented 2 years ago

Clearly what happened was my Chrome install was in a quantum superposition with every other Chrome instance worldwide, so when I reset it, it collapsed the wave function reducing them all to a single eigenstate. That seems to be the only logical explanation 🙃

proimage commented 2 years ago

What the actual heck. The problem has disappeared for me as well. The only Chrome difference is that the version went from 103.0.5060.114 to 103.0.5060.134.

Here's the release post: https://chromereleases.googleblog.com/2022/07/stable-channel-update-for-desktop_19.html Here is the diff: https://chromium.googlesource.com/chromium/src/+log/103.0.5060.114..103.0.5060.134?pretty=fuller&n=10000

Anyone see anything incriminating?

croxton commented 2 years ago

What the actual heck. The problem has disappeared for me as well. The only Chrome difference is that the version went from 103.0.5060.114 to 103.0.5060.134.

Here's the release post: https://chromereleases.googleblog.com/2022/07/stable-channel-update-for-desktop_19.html Here is the diff: https://chromium.googlesource.com/chromium/src/+log/103.0.5060.114..103.0.5060.134?pretty=fuller&n=10000

Anyone see anything incriminating?

Mine was already at 103.0.5060.134 when I first noticed the problem 🤷🏻‍♂️

alexr8 commented 2 years ago

What the actual heck. The problem has disappeared for me as well. The only Chrome difference is that the version went from 103.0.5060.114 to 103.0.5060.134.

My version is exactly the same as when i had the issue (103.0.5060.134), so not sure its the new release thats changed anything 🤔

adrianjean commented 2 years ago

Ok... so... SAME. I did nothing except go to bed, then wake up, and it's all working now. ¯\ (ツ)

bymayo commented 2 years ago

@adrianjean It's amazing when bugs fix themselves, whilst you sleep. It just doesn't happen near enough 😂

turnstylerj commented 2 years ago

Very strange, this is still an issue for me on Chrome 103.0.5060.134 on macOS 12.2.1.

turnstylerj commented 2 years ago

Update: Completely quitting and relaunching Chrome has resolved this for me. Same exact versions of everything. 🤷

proimage commented 2 years ago

@adrianjean It's amazing when bugs fix themselves, whilst you sleep. It just doesn't happen near enough 😂

That's the absolute worst case scenario IMO—when you don't know why a bug is happening in the first place, yet it gets mysteriously resolved without anything that you're aware of changing? Ugh.

stephanwergles commented 2 years ago

How crazy is that? I still have Chrome version 103.0.5060.134 and overnight the problem is solved. macOS 12.4

twitcher07 commented 2 years ago

Update: Completely quitting and relaunching Chrome has resolved this for me. Same exact versions of everything. 🤷

I can confirm on my MacOS chrome version 103.0.5060.134 that quitting chrome and relaunching has brought the icons back for me.

image

benediktblank commented 2 years ago

Update: Completely quitting and relaunching Chrome has resolved this for me. Same exact versions of everything. 🤷

It suddenly started working again 2 days ago, yeah. Quitting and relaunching did nothing for me before that day. Something else must have changed. But Chrome version is indeed the same one.

Edit: Huh or maybe the last number did increase.

robzor commented 2 years ago

OS X Catalina - 10.15.7 Chrome - 103.0.5060.134

Had this today, doing a proper Quit and relaunch of Chrome fixed it for me.

DavidKabelitz commented 2 years ago

Hey guys, i have the same Chrome issue here. I restarted Chrome tons of time but still icons are missing. What do mean with "proper Quit"? Also some Ajax things are not working. Looks like a random bug on chrome

Bildschirmfoto 2022-08-09 um 10 22 05

.

darylknight commented 2 years ago

Hey guys, i have the same Chrome issue here. I restarted Chrome tons of time but still icons are missing. What do mean with "proper Quit"? Also some Ajax things are not working. Looks like a random bug on chrome. @DavidKabelitz

I think your specific issue is unrelated. The rest of us had the icons completely missing. Typically if you're seeing the alt text of the icon, I've found that it's because your site isn't redirecting to a single version of the site correctly (i.e, you can access the site from both https:// or http://, and/or the non-www version or the www version. You need to make sure that you redirect traffic to the exact version you have listed in .env.

DavidKabelitz commented 2 years ago

@darylknight yes you are right, our local server runs on localhost and an ip, with the ip its working but not with the hostname and it was related to your comment. But it just happens at Chrome, that's strange.

darylknight commented 2 years ago

@DavidKabelitz Yep, separate issue. You need to access your site on only the URL that matches your .env file. Feel free to ping me or the Discord server about this so we don't clutter this github issue.

DavidKabelitz commented 2 years ago

Yes i know, we just recognized it after the comment here