From: Scott Worley Date: Thu, 27 Jan 2022 08:36:25 +0000 (-0800) Subject: Don't select-all the task description when beginning editing X-Git-Url: http://git.scottworley.com/vopamoi/commitdiff_plain/3a731557d09232dbf6871a33cff2cbeda42db880?ds=inline;hp=ad72cd51833c7202a3af3bd403c06616e4050b88 Don't select-all the task description when beginning editing I find that * most edits are more gentle than complete replacement * I consistently reach for the "end" key to begin editing * If I want complete replacement, ^A is easier to type than "end" --- diff --git a/vopamoi.ts b/vopamoi.ts index 7bdf4b8..01e761c 100644 --- a/vopamoi.ts +++ b/vopamoi.ts @@ -49,12 +49,11 @@ const Model = { const input = target.children[0] as HTMLInputElement; if ( input.value === target.getAttribute("data-description") && - input.selectionStart === 0 && + input.selectionStart === input.value.length && input.selectionEnd === input.value.length ) { // No local changes have actually been made yet. Change the contents of the edit box! input.value = newDescription; - input.select(); } else { // No great options. // Prefer not to interrupt the local user's edit. @@ -215,7 +214,6 @@ function BrowserUI() { task.textContent = ""; task.appendChild(input); input.focus(); - input.select(); event.preventDefault(); },