Selaa lähdekoodia

enh: title edit should auto focus to input

Timothy Jaeryang Baek 6 kuukautta sitten
vanhempi
commit
006208f9a9
1 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 8 2
      src/lib/components/layout/Sidebar/ChatItem.svelte

+ 8 - 2
src/lib/components/layout/Sidebar/ChatItem.svelte

@@ -234,6 +234,7 @@
 			<input
 				use:focusEdit
 				bind:value={chatTitle}
+				id="chat-title-input-{id}"
 				class=" bg-transparent w-full outline-none mr-10"
 			/>
 		</div>
@@ -362,10 +363,15 @@
 					archiveChatHandler={() => {
 						archiveChatHandler(id);
 					}}
-					renameHandler={() => {
+					renameHandler={async () => {
 						chatTitle = title;
-
 						confirmEdit = true;
+
+						await tick();
+						const input = document.getElementById(`chat-title-input-${id}`);
+						if (input) {
+							input.focus();
+						}
 					}}
 					deleteHandler={() => {
 						showDeleteConfirm = true;