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"
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.
task.textContent = "";
task.appendChild(input);
input.focus();
- input.select();
event.preventDefault();
},