Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Sometimes Icons don't render on firefox on ubuntu

Open MartinSchoeler opened this issue 9 years ago • 21 comments

screenshot from 2017-08-30 10-52-20

MartinSchoeler avatar Aug 30 '17 14:08 MartinSchoeler

On which Firefox version do tested?

karlprieb avatar Aug 30 '17 14:08 karlprieb

Tested on a firefox 54.0 (64-bit) (firefox for ubuntu canonical - 1.0) on a ubuntu 16.04 LTS Edit: on version 55.0.3 (64-bit) it works fine, the problem seems to be with the one that comes pre installed with ubuntu

MartinSchoeler avatar Aug 30 '17 14:08 MartinSchoeler

Having this issue on firefox 55, nixos and archlinux. Works fine on firefox 57.

Lemmmy avatar Aug 30 '17 22:08 Lemmmy

@RocketChat/core Guys I see same issue on Firefox 55. Why new UI design have many issue on Firefox? :thinking:

cyclops24 avatar Sep 05 '17 02:09 cyclops24

We have this issue with Firefox 54... Is there an option to use the old design?

mfueser avatar Sep 18 '17 08:09 mfueser

I don't think the new design is released in a stable version yet - just revert back to a stable version?

Lemmmy avatar Sep 18 '17 11:09 Lemmmy

@karlprieb It's still happens sometimes. :cry:

cyclops24 avatar Oct 08 '17 04:10 cyclops24

Part of #8494

cyclops24 avatar Oct 15 '17 06:10 cyclops24

Face this issue using Firefox 52 esr on Windows. Rocket 0.59 release.

avagulov avatar Oct 25 '17 14:10 avagulov

Rocket.Chat version 0.52.9 Firefox 52.3

Pretty anoying bug as Firefox 52 is an ESR. Any lead on how to help on this ?

Cheers

magicbelette avatar Oct 26 '17 09:10 magicbelette

No luck here...

I tried something simple with svg to be sure (based on RocketChat 0.59.3 simplified sources, see below). It works like a charm with FF 52 et Chrome. I also tried the full code of RocketChat 0.59.3 but without css and I still don't see icons.

Ideas ?

<!DOCTYPE html>
<html>
<head/>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display: none">
<symbol id="icon-pin" viewBox="0 0 20 20">
<g stroke="currentColor" stroke-width="1.5" fill="none" fill-rule="evenodd"><path d="M13.497 14.719l3.119 3.12" stroke-linecap="square"></path><path d="M2.48 9.725a1.588 1.588 0 0 1-.004-2.239l4.627-4.627a1.583 1.583 0 0 1 2.24.004l-.37-.37a1.59 1.59 0 0 1-.003 2.243l-.124.124 3.743 3.744s2.496-1.247 4.992 1.248l-8.112 8.111c-2.495-2.495-1.248-4.991-1.248-4.991L4.478 9.228l-.125.125c-.62.62-1.624.621-2.244.002l.371.37z"></path></g>
</symbol>

<div class="tab-button" title="Pin">
        <button aria-label="Pin">
                <svg class="rc-icon tab-button-icon tab-button-icon--pin" aria-hidden="true">
                        <use xlink:href="#icon-pin"></use>
                </svg>
        </button>
</div>
</body>

magicbelette avatar Nov 03 '17 11:11 magicbelette

I've been testing some things too but to no avail. To me it looks like all elements that are not visible on the screen are base64 encoded SVG icons.

All of those missing icons have changed after 0.58 I think, and maybe they have some image property that bugs in CSS with Firefox ESR.

EDIT: Except that icons are not encoded in base64 it seems. They are in one file under:

programs/server/assets/packages/rocketchat_ui-master/public/icons.svg

in the format like this:

<symbol viewBox="0 0 20 20" id="icon-star"><path d="M10 15l-4.898 2.575.935-5.454-3.962-3.863 5.476-.796L10 2.5l2.45 4.962 5.475.796-3.962 3.863.935 5.454z" stroke-width="1.5" stroke="currentColor" /></symbol>

The format seems to be SVG or pretty close to it.

Nevertheless, how this gets decoded in Firefox ESR might be the problem.

Gummikavalier avatar Nov 05 '17 13:11 Gummikavalier

It seems to work if we use absolute url for href in tag, for example <use href="https://rebelraven.rocket.chat/channel/general#icon-bell"></use> instead of <use href="#icon-bell"></use>

Please, rocket.chat guys, fix it!

avagulov avatar Nov 09 '17 15:11 avagulov

@agulov Could it be a HTTPS issue? Try href="/channel/general#icon-bell" and href="http://rebelraven.rocket.chat/channel/general#icon-bell" (http instead of https)

Lemmmy avatar Nov 09 '17 16:11 Lemmmy

@Lemmmy href="/channel/general#icon-bell" works, i can see icon href="http://rebelraven.rocket.chat/channel/general#icon-bell" does not work

avagulov avatar Nov 10 '17 06:11 avagulov

Sorry, I can't understand how I can resolve this issue on my installation ( 0.59.3 ), someone can help me ? thanks

exagon avatar Nov 15 '17 10:11 exagon

Minimally tested hack for anyone that needs a temporary fix. JQuery/JavaScript is not my strong point, improvements appreciated. This goes in Administration -> Layout -> Custom Scripts.

This makes use of the absolute URL workaround pointed out by @agulov above. It appears to fix the icon problems in previous versions of Firefox without breaking Chromium or Firefox 59 - I haven't tested any other browsers. Use with caution and don't forget to take it out after a proper fix has been released.

// Hack to get SVG icons working on Firefox 52 ESR and other pre-59 versions
$(document).ready(function(){
  $("svg > use").map(function(){ 
    var svg_string = $(this)[0].href;

    if (svg_string.baseVal.startsWith("#")){
      svg_string.baseVal = window.location.href + svg_string.baseVal; 
      svg_string.animVal = window.location.href + svg_string.animVal;
    }
  });
})

EDIT/take 2: Some icons weren't getting caught with the above due to the lack of full page reloads while using Rocket.Chat - particularly, the vertical ribbon of channel option icons. So did a bit more research, and came up with a more robust seeming fix using MutationObservers; most of this is well above my JavaScript level and thanks to this StackOverflow hero:

// Hack to get SVG icons showing on Firefox 52 ESR and other pre-59 versions
$(document).ready(function(){ 
  var observer = new MutationObserver(expandSVGPathsOnMutation);
  observer.observe(document, {
    childList: true, // report added/removed nodes
    subtree: true,   // observe any descendant elements
  });
  
  // automatically updated HTMLCollection
  var svg_uses = document.getElementsByTagName("use");
  
  function expandSVGPathsOnMutation(mutations){
    if (mutations.length == 1){
      var added = mutations[0].addedNodes[0];
      if (!added || (added.localName !== 'use' && !added.children.length)){
        return;
      }
    }

    for (var i = 0, len = svg_uses.length; i < len; i++){
      var svg_string = svg_uses[i].href;
      if (svg_string.baseVal.startsWith("#")){
        svg_string.baseVal = window.location.href + svg_string.baseVal;
        svg_string.animVal = window.location.href + svg_string.animVal;
      }
    }
  }
})

kimgb avatar Dec 04 '17 05:12 kimgb

Thanks for the fix! Works like a charm!

fnollet avatar Dec 05 '17 07:12 fnollet

Yes, this Workaround works at my instance too, thanks a lot!

mhenninghaus77 avatar Dec 06 '17 10:12 mhenninghaus77

This test if (!added || (added.localName !== 'use' && !added.children.length)) was giving me a ton of "undefined has no properties" JavaScript errors, and in this case I don't think the children length check is needed. You should be OK to replace it with if (!added || added.localName !== 'use') if the errors bother you or are causing actual trouble.

kimgb avatar Dec 06 '17 23:12 kimgb