From 41e61b003e874c3a00cc10e6f469430bf312ccb7 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Mon, 18 Oct 2021 18:14:19 +0100 Subject: [PATCH] dev/core#2919 Hidden submit buttons are confussing for keyboard users Adds tabindex=-1 to hidden buttons, as hidden items should not be focussable. As the elements are not focussable and repeated in the modal footer, aria-hidden is also applied --- js/crm.ajax.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 609e1074a1..39f7c85ef9 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -511,6 +511,7 @@ var $el = $(this), label = $el.is('input') ? $el.attr('value') : $el.text(), identifier = $el.attr('name') || $el.attr('href'); + $el.attr('tabindex', '-1'); if (!identifier || identifier === '#' || $.inArray(identifier, added) < 0) { var $icon = $el.find('.icon, .crm-i'), button = {'data-identifier': identifier, text: label, click: function() { @@ -526,7 +527,7 @@ added.push(identifier); } // display:none causes the form to not submit when pressing "enter" - $el.parents(buttonContainers).css({height: 0, padding: 0, margin: 0, overflow: 'hidden'}); + $el.parents(buttonContainers).css({height: 0, padding: 0, margin: 0, overflow: 'hidden'}).attr('aria-hidden', 'true'); }); $el.dialog('option', 'buttons', buttons); } -- 2.25.1