Fix commit dialog backspace bug

- place curstor at end of commit title when backspacing from empty description
This commit is contained in:
Mattias Granlund 2024-06-28 11:31:32 +02:00
parent f67744eea1
commit 8f052c04b7

View File

@ -161,7 +161,10 @@
const value = e.currentTarget.value;
if (e.key === 'Backspace' && value.length === 0) {
e.preventDefault();
titleTextArea?.focus();
if (titleTextArea) {
titleTextArea?.focus();
titleTextArea.selectionStart = titleTextArea.textLength;
}
useAutoHeight(e.currentTarget);
} else if (e.key === 'a' && (e.metaKey || e.ctrlKey) && value.length === 0) {
// select previous textarea on cmd+a if this textarea is empty