From 8ed048480765a65e7da17cb915c46907fef1e8a2 Mon Sep 17 00:00:00 2001 From: jensmjahle <126790845+jensmjahle@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:58:41 +0200 Subject: [PATCH] Add tabindex to file selector in CreateMilestoneView.vue --- src/views/HomePage/CreateMilestoneView.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/views/HomePage/CreateMilestoneView.vue b/src/views/HomePage/CreateMilestoneView.vue index adbbea1..92f9532 100644 --- a/src/views/HomePage/CreateMilestoneView.vue +++ b/src/views/HomePage/CreateMilestoneView.vue @@ -82,6 +82,13 @@ const handleFileChange = (event: any) => { } reader.readAsDataURL(file) } +const fileInput = ref(null); + +const openFileExplorer = () => { + if (fileInput.value) { + fileInput.value.click(); + } +}; </script> @@ -156,12 +163,12 @@ const handleFileChange = (event: any) => { <div class="image-container"> <label>Legg til et bilde</label> <div class="add-image-box"> - <label> + <button @click="openFileExplorer" tabindex="0" type="button"> <input type="file" style="display: none" ref="fileInput" accept="image/png, image/jpeg" @change="handleFileChange"> <img v-if="image" :src="image" id="literal-image" alt="Selected Image" width="150px" height="150px"> <img v-else src="../../components/icons/image/AddImage.png" alt="Add Image" width="50px" height="50px"> - </label> + </button> </div> <!-- <div class="existing-pictures">--> <!-- <div class="existing-image-box"></div>--> -- GitLab