0

I have a scenario, to activate the keyboard highlighting I need to add the contentEditable = true on enter press when focus is on main tag. Problem is that the tab press on focus comes on the main tag and I press the enter editing on content gets activated but the cursor is not visible on the first text of paragraph. This is because I have a hidden p tag in my html which consumes the cursor on enter press.

<p class="screen-reader-only">Page 4 and 5</p> 
<style>
.screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
</style>

Really stuck, Anybody please help?

Neelu
  • 1
  • 1
  • [This](https://stackoverflow.com/questions/6249095/how-to-set-the-caret-cursor-position-in-a-contenteditable-element-div) might be helpful. – Shad0w Dec 15 '22 at 07:21
  • So the hidden `

    ` is _inside_ the `contentEditable`? That doesn’t seem to make sense. Could you please share more code?

    – Andy Dec 15 '22 at 10:27

0 Answers0