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

212
Views
The cursor is hidden by 'position: sticky' element

I have a div anchored to the top of the page using "position: sticky", also have a div below which is editable (contenteditable="true") and it has lots of lines.

Please see the code snippet below:

.scrollable {
  padding: 0.5em;
  box-sizing: border-box;
}

.top {
    position: sticky;
    top: 0;
    z-index: 2;
      background-color: yellow;
}
<html>
<body>

<div class="top">
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
    sticky line<br/>
</div>

<div contenteditable="true" class="scrollable" data-placeholder="Click here to type">
the first line<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
f<br/>dfsd<br/>
ds<br/>
fsd<br/>
f<br/>
dfsd<br/>
ds<br/>
fsd<br/>
the last line<br/>
</div>

If I use arrow Down in keyboard to move cursor to the very bottom, then use arrow UP in keyboard to move the cursor all the way up, the cursor will eventually move into the top div area and thus be hidden, making typing invisible.

What I want to achieve is:

  1. When the cursor reach the top border of lower div, instead of moving cursor into the top div, can we scroll the content to show the lines above?
  2. The scroll bar has to apply to the whole page, just as what it is now.
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!