add focus on button when select all

This commit is contained in:
Lisa Durand 2023-04-05 10:59:59 +02:00
parent c9d21f2b4d
commit 058f1fe6e5
2 changed files with 14 additions and 2 deletions

View file

@ -3,13 +3,13 @@
#not_selected
%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{ 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")

View file

@ -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 }) {