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

137
Views
Firefox, double click on empty line, contenteditable div

I'm working on a html editor (contenteditable div) and came across this issue: double (or triple) clicking on empty lines like <div><span><br></span></div> behaves differently in safari/chrome and firefox. In safari and chrome the empty lines get highlighted and selected. this is what I expect. but in firefox the caret dissappears and range.startcontainer is the container div (the contenteditable) instead of the empty line. firefox doesn't highlight the span/empty line, I'm OK with that, but I would like to change the behaviour to act like a single click (caret stays in place and range.startcontainer is <span>.

You may ask what I want to to with empty lines. I've made some functions for styling options (change to list/bullet points for example) that should be accessible even when double clicking on the empty line.

I've tried to solve this by saving the start node on the first click and then restore it when the users clicks 2 or more times and bring the caret back by collapsing the range. but I guess there's a better/cleaner solution since it's only needed for ff.

any ideas appreciated!

about 4 years ago · Santiago Trujillo
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!