JSFiddle - React, Tailwind, and code Playground

HTML

<div id="editable" style=" border:solid 1px #D31444" contenteditable="true" 
onfocus="document.execCommand('selectAll',false,null);">12 some text...</div>

<div id="editable-patched" style=" border:solid 1px #D31444" contenteditable="true" 
onfocus="selectAll();">12 some text... (patched)</div>

<button onclick="document.getElementById('editable').focus();" >Click me</button>

<button onclick="document.getElementById('editable-patched').focus();" >Click me (patched)</button>

JavaScript

function selectAll() {
requestAnimationFrame(() => document.execCommand('selectAll'));
}