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

164
Views
Handle editable element behind another element

I am working on a project where it implements an email editor, something like Gmail editor. It has "Recipients and Subject" always on top and the scrollable editor area below it. So, what I want to achieve is:

  • Let the top part always stay on top at fixed position, even we are scrolling the editor content below
  • If the content in the editor is too long, scrolling the page down should move the top content behind the top part. At this point, if we keep pressing "Up" key, it should bring the top hidden content back, instead of moving the cursor up.

I have the gif below to explain it better hopefully:

enter image description here

I am able to achieve the first one by using sticky property, but I cannot do the 2nd one. If I type long content inside the editor area, make it partially hidden by the top part, then if I keep pressing "up", it will eventually move the cursor into the top area, thus hiding the cursor, and I am unable to bring the top hidden content back using "Up" key.

div.sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 10px;
  background-color: yellow;
  padding: 50px;
  font-size: 20px;
}
<html>
<div class="sticky">I will stick to the screen when you reach my scroll position</div>
<div contenteditable="true">
</div>
</html>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Utilizing the sticky div as a container for text might help, I also wrote a small helper function for breaks to test the scrolling feature:

div.sticky {
  position: -webkit-sticky;
  position: sticky;
  top: 10px;
  background-color: yellow;
  padding: 50px;
  font-size: 20px;
}
<div class="sticky">
<input placeholder="Recipients">
<br>
<input placeholder="Subject">
</div>

<div contenteditable="true">

<script> 
for(var x=0;x<=100;x++){ 
document.write("<br>") } 
</script> 
  
<h1>test</h1>
</html>

about 4 years ago · Juan Pablo Isaza Report
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!