amelioration(a11y): upload, quand on supprime un fichier, refocus sur l'input d'upload. quand on ajoute un fichier, refocus sur le fichier ajouté

This commit is contained in:
Martin 2023-01-23 16:21:24 +01:00 committed by mfo
parent c3fd555e6c
commit d2cd2d2b7b
2 changed files with 4 additions and 2 deletions

View file

@ -2,5 +2,6 @@
- if @champ_id
= turbo_stream.show "attachment-multiple-empty-#{@champ_id}"
= turbo_stream.focus_all "#attachment-multiple-empty-#{@champ_id} input"
= turbo_stream.show_all ".attachment-input-#{@attachment.id}"

View file

@ -2,5 +2,6 @@
= turbo_stream.replace @champ.input_group_id do
= render EditableChamp::EditableChampComponent.new champ: @champ, form: form
- @champ.piece_justificative_file.attachments.each do |attachment|
= turbo_stream.focus_all "button[data-toggle-target=\".attachment-input-#{attachment.id}\"]"
- last_attached_file = @champ.piece_justificative_file.attachments.last
- if last_attached_file
= turbo_stream.focus_all "#persisted_row_attachment_#{last_attached_file.id} .attachment-filename a"