I am making a typewriter-like website (here) that uses a textarea and javascript (from button clicks) to add/remove from the textarea.
After following these 2 answers (1, 2) I am now using the default typing indicator to show text position.
To prevent users from clicking in other places in the textarea I added pointer-events:none to the textarea's css, however this also blocks highlighting part or all of the text to manually copy it.
This is the textarea
<textarea id="textarea" class="textarea" data-gramm_editor="false" data-gramm="false">
</textarea>
with this css
.textarea {
pointer-events:none;
font-size: 23px;
width: 100%;
height: 150px;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
background-color: #f8f8f8;
resize: none;
}
Visual explanation: I want to be able to select like this without being able to click around and do this this.
Is there a way to separate the click and highlighting and only block the clicks?
If a solution won't work smoothly on mobile devices that's still ok just indicate/explain.