Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
Firefox problem closing input <type = "colour">

I am using colour picker in my project using input <type = "colour">. While using Chrome everything works fine, Colour picker can be closed by clicking on any part of the browser and also when i refresh or close the current tab. However, in case of firefox browser there is a very specific close button to close the colour picker and when i refresh or close the current tab the colour picker still remains there unless i close it using the respective button.

I came across a solution mentioned in How to close an html5 color picker? but the following solution is not effective for firefox either:

var input = document.getElementById('my-color');

// when you click the color picker, we'll run our code to close it after 2 seconds.
input.addEventListener('focus', function() {
  setTimeout(()=>{
  
    // toggle the type attribute to close the picker!
    input.setAttribute('type','text');
    input.setAttribute('type','color');
    
  }, 2000);
});

<input type="color" value="#ffaacc" id="my-color"/> <- Click me

How can i replicate the chrome behaviour for firefox as well?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda