correctif(dropdown): rend toutes les dropdown valide via le controller.js plutot que les balises html

This commit is contained in:
Martin 2022-11-02 17:17:00 +01:00 committed by mfo
parent 571452c530
commit 95312fed47
2 changed files with 16 additions and 6 deletions

View file

@ -40,6 +40,16 @@ export class MenuButtonController extends ApplicationController {
for (const menuItem of this.menuTarget.querySelectorAll('a')) {
menuItem.setAttribute('role', 'menuitem');
}
for (const dropdownItems of this.menuTarget.querySelectorAll(
'.dropdown-items'
)) {
dropdownItems.setAttribute('role', 'none');
}
for (const dropdownItems of this.menuTarget.querySelectorAll(
'.dropdown-items > li'
)) {
dropdownItems.setAttribute('role', 'none');
}
}
this.on('click', (event) => {

View file

@ -9,37 +9,37 @@
%button.button.dropdown-button{ data: { menu_button_target: 'button' } }
= t('views.users.dossiers.dossier_action.actions')
.dropdown-content.fade-in-down{ data: { menu_button_target: 'menu' }, id: dom_id(dossier, :actions_menu) }
%ul.dropdown-items{ role: :none }
%ul.dropdown-items
- if has_edit_action
- if dossier.brouillon?
%li{ role: :none }
%li
= link_to(url_for_dossier(dossier)) do
%span.icon.edit
.dropdown-description
= t('views.users.dossiers.dossier_action.edit_draft')
- else
%li{ role: :none }
%li
= link_to modifier_dossier_path(dossier) do
%span.icon.edit
.dropdown-description
= t('views.users.dossiers.dossier_action.edit_dossier')
- if has_transfer_action
%li{ role: :none }
%li
= link_to transferer_dossier_path(dossier) do
%span.icon.person
.dropdown-description
= t('views.users.dossiers.dossier_action.transfer_dossier')
- if has_new_dossier_action
%li{ role: :none }
%li
= link_to procedure_lien(dossier.procedure) do
%span.icon.new-folder
.dropdown-description
= t('views.users.dossiers.dossier_action.start_other_dossier')
- if has_delete_action
%li.danger{ role: :none }
%li.danger
= link_to delete_dossier_dossier_path(dossier), method: :patch, data: { disable: true, confirm: "En continuant, vous allez supprimer ce dossier ainsi que les informations quil contient. Toute suppression entraîne lannulation de la démarche en cours.\n\nConfirmer la suppression ?" } do
%span.icon.delete
.dropdown-description