Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
Interesting (that is, annoying) Chrome problem with hiding/showing a canvas using opacity

The following code, designed to temporarily hide a sky map, contained in a canvas that overlays a clock face, works fine on Firefox, but not on Chrome:

  private skyClick = (_event: MouseEvent) => {
    this.hideSkyMap = true;
    this.skyCanvas.style.pointerEvents = 'none';
    this.skyCanvas.style.opacity = '0';

    this.hideSkyMapTimer = setTimeout(() => {
      this.hideSkyMap = false;
      this.skyCanvas.style.pointerEvents = 'all';
      this.skyCanvas.style.opacity = '1';
    }, 60000);
  }

What's weird is that if I go into the Chrome web console, merely highlighting the canvas element causes it to reappear. It seems to be a matter that the canvas isn't automatically being repainted after the opacity is set to 1, and it needs a nudge of some sort to force it to appear again.

What's even stranger is that if I restore the opacity to 0.99 rather than 1, the canvas properly reappears as well.

Anyone have a better idea on how to fix this, other than settling for somewhat less than full opacity when I restore the canvas?

I'm not using display none/block, which would be more straightforward, because I want to animate the transition so the sky map fades in and out.

UPDATE:

Oddly enough, after I added the animation I wanted to have, using transition: opacity 1s, that also fixed the problem. The animation of the opacity change seems to be a good way to force the repainting of the canvas.

I'm still curious if there's another work-around for this bug, but the answer isn't as important now.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I had the same problem, and I set the will-change: opacity to resolve it.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda