amelioration(a11y.invites): focus sur la liste des invitations lorsqu'on ajoute un invite a un dossier

This commit is contained in:
Martin 2022-12-28 16:47:52 +01:00 committed by mfo
parent ddc04a03a4
commit c3fd555e6c
6 changed files with 17 additions and 15 deletions

View file

@ -11,4 +11,4 @@
- else
= t('views.invites.dropdown.invite_to_edit')
- menu.with_form do
= render partial: "invites/form", locals: { dossier: dossier, invites: invites }
= render partial: "invites/form", locals: { dossier: dossier, invites: invites, morphing: morphing }

View file

@ -1,12 +1,14 @@
#invites-form
- if invites.present?
%h4= t('views.invites.form.invite_to_participate')
%ul
- invites.each do |invite|
%li
= invite.email
%small{ 'data-turbo': 'true' }
= link_to t('views.invites.form.withdraw_permission'), invite_path(invite), data: { turbo_method: :delete, turbo_confirm: t('views.invites.form.want_to_withdraw_permission') }
#invite-list{ morphing ? { tabindex: "-1" } : {} }
%h4= t('views.invites.form.invite_to_participate')
%ul
- invites.each do |invite|
%li
= invite.email
%small{ 'data-turbo': 'true' }
= link_to t('views.invites.form.withdraw_permission'), invite_path(invite), data: { turbo_method: :delete, turbo_confirm: t('views.invites.form.want_to_withdraw_permission') }
%p= t('views.invites.form.edit_dossier')
- if dossier.brouillon?
%p= t('views.invites.form.submit_dossier_yourself')

View file

@ -1,2 +1,2 @@
= turbo_stream.replace_all '.invite-user-action', partial: 'invites/dropdown', locals: { dossier: @dossier }
= turbo_stream.focus 'invite_email'
= turbo_stream.replace_all '.invite-user-action', partial: 'invites/dropdown', locals: { dossier: @dossier, morphing: true }
= turbo_stream.focus 'invite-list'

View file

@ -1,6 +1,6 @@
- if @dossier.present?
= turbo_stream.replace_all '.invite-user-action', partial: 'invites/dropdown', locals: { dossier: @dossier }
= turbo_stream.replace_all '.invite-user-action', partial: 'invites/dropdown', locals: { dossier: @dossier, morphing: true }
- if @dossier.invites.empty?
= turbo_stream.focus 'invite_email'
= turbo_stream.focus 'invite-list'
- else
= turbo_stream.focus_all '#invites-form ul a:first-child'
= turbo_stream.focus 'invite_email'

View file

@ -12,7 +12,7 @@
= render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier })
- elsif current_user.owns?(dossier)
.header-actions
= render partial: 'invites/dropdown', locals: { dossier: dossier }
= render partial: 'invites/dropdown', locals: { dossier: dossier, morphing: false }
- unless dossier.read_only?
= render partial: 'users/dossiers/identity_dropdown', locals: { dossier: dossier }

View file

@ -16,7 +16,7 @@
= render(partial: 'users/dossiers/procedure_removed_banner', locals: { dossier: dossier })
- elsif current_user.owns?(dossier)
.header-actions
= render partial: 'invites/dropdown', locals: { dossier: dossier }
= render partial: 'invites/dropdown', locals: { dossier: dossier, morphing: false }
- if dossier.can_be_updated_by_user? && !current_page?(modifier_dossier_path(dossier))
= link_to t('views.users.dossiers.show.header.edit_dossier'), modifier_dossier_path(dossier), class: 'fr-btn fr-btn-sm',
title: { label: t('views.users.dossiers.show.header.edit_dossier_title') }