Please check below fiddle
<div contenteditable="true">
<span class="edit-label">
Edit me
<div class="alias-edit-div">
</div>
</span>
<span>
Other text1
</span>
<span>
Other text2
</span>
I want a solution so that user can frequently move cursor using left/right arrow key on the editable div element
You can add :
[contenteditable="true"]:active .alias-edit-div,
[contenteditable="true"]:focus .alias-edit-div{
display:none !important;
}
to hide de pencil when the user is editing. So the .alias-edit-div
will not block the cursor.
Moreover on an UX level it is better to not have the pencil icon displayed when the user is editing the content.
PS : you should consider not using div
inside span
because it is not html5 valid.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.