diff --git a/app/components/dossiers/batch_select_more_component/batch_select_more_component.html.haml b/app/components/dossiers/batch_select_more_component/batch_select_more_component.html.haml index 809370e4c..69f772299 100644 --- a/app/components/dossiers/batch_select_more_component/batch_select_more_component.html.haml +++ b/app/components/dossiers/batch_select_more_component/batch_select_more_component.html.haml @@ -1,15 +1,15 @@ %tr#js_batch_select_more.fr-background-alt--blue-france.hidden %td.fr-py-2w.text-center{ colspan: 100 } #not_selected - %p + %p{ role: "status" } = t('.pagination_files_selected_html') - %button.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: not_selected_button_data } + %button#js_select_more.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: not_selected_button_data } = not_selected_text #selected.hidden - %p + %p{ role: "status" } = selected_text - %button.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: selected_button_data } + %button#js_delete_selection.fr-btn.fr-btn--sm.fr-btn--tertiary-no-outline{ data: selected_button_data } = t(".delete_selection") = hidden_field_tag :"batch_operation[dossier_ids][]", "", form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "input_multiple_ids") diff --git a/app/javascript/controllers/batch_operation_controller.ts b/app/javascript/controllers/batch_operation_controller.ts index f4bc480b9..abc294b9c 100644 --- a/app/javascript/controllers/batch_operation_controller.ts +++ b/app/javascript/controllers/batch_operation_controller.ts @@ -24,6 +24,12 @@ export class BatchOperationController extends ApplicationController { if (pagination) { displayNotice(this.inputTargets); } + + // add focus on button for a11y + const button = document.getElementById('js_select_more'); + if (button) { + button.focus(); + } } onSelectMore(event: { @@ -44,6 +50,12 @@ export class BatchOperationController extends ApplicationController { hide(document.querySelector('#not_selected')); show(document.querySelector('#selected')); + + // add focus on button for a11y + const button = document.getElementById('js_delete_selection'); + if (button) { + button.focus(); + } } onDeleteSelection(event: { preventDefault: () => void }) { diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index f29885be5..2a8c677fe 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -340,6 +340,22 @@ class ProcedurePresentation < ApplicationRecord end end + def sortable?(field) + sort['table'] == field['table'] && sort['column'] == field['column'] + end + + def aria_sort(order, field) + if sortable?(field) + if order == 'asc' + { "aria-sort": "ascending" } + elsif order == 'desc' + { "aria-sort": "descending" } + end + else + {} + end + end + private def field_id(field) diff --git a/app/views/instructeurs/procedures/_header_field.html.haml b/app/views/instructeurs/procedures/_header_field.html.haml index 5d852a592..e4a54d673 100644 --- a/app/views/instructeurs/procedures/_header_field.html.haml +++ b/app/views/instructeurs/procedures/_header_field.html.haml @@ -1,6 +1,7 @@ -%th{ class: classname } +%th{ @procedure_presentation.aria_sort(@procedure_presentation.sort['order'], field), scope: "col", class: classname } + = link_to update_sort_instructeur_procedure_path(@procedure, table: field['table'], column: field['column'], order: @procedure_presentation.opposite_order_for(field['table'], field['column'])) do - - if @procedure_presentation.sort['table'] == field['table'] && @procedure_presentation.sort['column'] == field['column'] + - if @procedure_presentation.sortable?(field) - if @procedure_presentation.sort['order'] == 'asc' #{field['label']} ↑ - else diff --git a/app/views/instructeurs/procedures/show.html.haml b/app/views/instructeurs/procedures/show.html.haml index 4bb34f922..f715e9e22 100644 --- a/app/views/instructeurs/procedures/show.html.haml +++ b/app/views/instructeurs/procedures/show.html.haml @@ -133,9 +133,9 @@ %td.text-center - if batch_operation_component.render? - if p.batch_operation_id.present? - = check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, true, disabled: true, id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.disabled') } + = check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, true, disabled: true, id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.disabled', dossier_id: p.dossier_id) } - else - = check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { batch_operation_target: "input", action: "batch-operation#onCheckOne", operations: batch_operation_component.operations_for_dossier(p).join(',') }, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.enabled') } + = check_box_tag :"batch_operation[dossier_ids][]", p.dossier_id, false, data: { batch_operation_target: "input", action: "batch-operation#onCheckOne", operations: batch_operation_component.operations_for_dossier(p).join(',') }, form: dom_id(BatchOperation.new), id: dom_id(BatchOperation.new, "checkbox_#{p.dossier_id}"), aria: { label: t('views.instructeurs.dossiers.batch_operation.enabled', dossier_id: p.dossier_id) } - if @not_archived_notifications_dossier_ids.include?(p.dossier_id) %span.notifications{ 'aria-label': 'notifications' } diff --git a/config/locales/en.yml b/config/locales/en.yml index df541fd40..f5d189fb9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -371,8 +371,8 @@ en: title: Select a filter select_all: Select all batch_operation: - enabled: "Add this file to the selection for the bulk operation" - disabled: "Impossible to add this file to the selection because it is already in a bulk operation" + enabled: "Add file %{dossier_id} to the selection for the bulk operation" + disabled: "Impossible to add file %{dossier_id} to the selection because it is already in a bulk operation" personalize: Personalize the table show_deleted_dossiers: Show deleted files follow_file: Follow-up the file diff --git a/config/locales/fr.yml b/config/locales/fr.yml index df026be97..cd52c4f3a 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -371,8 +371,8 @@ fr: title: Sélectionner un filtre select_all: Tout selectionner batch_operation: - enabled: "Ajouter ce dossier à la selection pour un traitement de masse" - disabled: "Impossible d'ajouter ce dossier à la selection car il est déjà dans un traitement de masse" + enabled: "Ajouter le dossier %{dossier_id} à la selection pour un traitement de masse" + disabled: "Impossible d'ajouter le dossier %{dossier_id} à la selection car il est déjà dans un traitement de masse" show_deleted_dossiers: Afficher les dossiers supprimés personalize: Personnaliser le tableau download: Télécharger un dossier