77b981298a7fc1cd80b7f4cafb95fdba936ceb93

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Use js for autofocus after all

Diff

This diff is truncated to protect this page.

 1diff --git a/assets/index.js b/assets/index.js
 2index 2425c7604404a1fcdd58afa2556f157146d00ffb..82810f72a1aa7f9e7b25e7a7184ed32ec70d94b6 100644
 3--- a/assets/index.js
 4+++ b/assets/index.js
 5@@ -1,4 +1,12 @@
 6 document.addEventListener("DOMContentLoaded", function() {
 7+	const addVideoModal = document.getElementById("add-video-modal");
 8+	if (addVideoModal) {
 9+		addVideoModal.addEventListener("shown.bs.modal", function () {
10+			const input = addVideoModal.querySelector("input[name='video_id']");
11+			if (input) input.focus();
12+		});
13+	}
14+
15 	const searchInput = document.getElementById("video-search");
16 	if (!searchInput) return;
17 
18diff --git a/pages/add_video_modal.templ b/pages/add_video_modal.templ
19index 34a04d66c4f785a031a105f583faa4bf545d86ff..50af9365cb9286e47ee4775fe38b514fe60a01e7 100644
20--- a/pages/add_video_modal.templ
21+++ b/pages/add_video_modal.templ
22@@ -22,8 +22,7 @@ templ addVideoModal() {
23 							name="video_id"
24 							placeholder="Video ID"
25 							class="form-control"
26-							autocomplete="off"
27-							autofocus
28+						autocomplete="off"
29 						/>
30 						<button type="submit" class="btn btn-primary ms-3"><i class="bi bi-camera-video"></i></button>
31 					</form>
32diff --git a/pages/add_video_modal_templ.go b/pages/add_video_modal_templ.go
33index d5bbe9e8421235d9ad2b18817ba530ff4a7c7a43..0195ddf46b74cbf91f03f36010f80766b63000d0 100644
34--- a/pages/add_video_modal_templ.go
35+++ b/pages/add_video_modal_templ.go
36@@ -30,7 +30,7 @@ func addVideoModal() templ.Component {
37 			templ_7745c5c3_Var1 = templ.NopComponent
38 		}
39 		ctx = templ.ClearChildren(ctx)