diff --git a/app/javascript/controllers/profile_image_preview_controller.js b/app/javascript/controllers/profile_image_preview_controller.js index cf58be75..83134e38 100644 --- a/app/javascript/controllers/profile_image_preview_controller.js +++ b/app/javascript/controllers/profile_image_preview_controller.js @@ -22,7 +22,10 @@ export default class extends Controller { this.deleteProfileImageTarget.value = "1"; this.uploadTextTarget.classList.remove("hidden"); this.changeTextTarget.classList.add("hidden"); + this.changeTextTarget.setAttribute("aria-hidden", "true"); + this.uploadTextTarget.setAttribute("aria-hidden", "false"); this.cameraIconTarget.classList.remove("!hidden"); + } showFileInputPreview(event) { @@ -36,6 +39,8 @@ export default class extends Controller { this.deleteProfileImageTarget.value = "0"; this.uploadTextTarget.classList.add("hidden"); this.changeTextTarget.classList.remove("hidden"); + this.changeTextTarget.setAttribute("aria-hidden", "false"); + this.uploadTextTarget.setAttribute("aria-hidden", "true"); this.cameraIconTarget.classList.add("!hidden"); this.previewImageTarget.querySelector("img").src = URL.createObjectURL(file); diff --git a/app/views/settings/_user_avatar_field.html.erb b/app/views/settings/_user_avatar_field.html.erb index d1e9a821..5c224444 100644 --- a/app/views/settings/_user_avatar_field.html.erb +++ b/app/views/settings/_user_avatar_field.html.erb @@ -40,10 +40,10 @@ <%= form.label :profile_image, class: "btn btn--outline inline-block", data: { profile_image_preview_target: "uploadButton" } do %> <%= lucide_icon "camera", class: "w-5 h-5 mr-2 inline-block", data: { profile_image_preview_target: "cameraIcon" } %> - + <%= t(".choose") %> <%= t(".choose_label") %> - + <% end %>