Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!