add screen reader support for Swap axes button

This commit is contained in:
daria 2025-06-24 12:38:16 +03:00
parent 8d8e314787
commit 522b06366e
No known key found for this signature in database
GPG Key ID: 3B75240E6B2F2701
2 changed files with 10 additions and 1 deletions

View File

@ -145,6 +145,9 @@ define(req, function(AppConfig, Default, Language) {
Messages.hide_password = "Hide password";
Messages.next_templateList = "Next template list";
Messages.previous_templateList = "Previous template list";
Messages.forms_switchHorizontalAxe = 'Switch to horizontal layout';
Messages.forms_switchVerticalAxe = 'Switch to vertical layout';
return Messages;
});

View File

@ -759,7 +759,10 @@ define([
]);
});
// Insert axis switch button
var switchAxis = h('button.btn.btn-default', [
var switchAxis = h('button.btn.btn-default', {
'aria-pressed': 'false',
'aria-label': Messages.forms_switchVerticalAxe
}, [
Messages.form_poll_switch,
h('i.fa.fa-exchange'),
]);
@ -837,6 +840,9 @@ define([
var $s = $(switchAxis).click(function () {
$s.closest('.cp-form-type-poll').toggleClass('cp-form-poll-switch');
var pressed = $s.attr('aria-pressed') === 'true';
$s.attr('aria-pressed', !pressed);
$s.attr('aria-label', !pressed ? Messages.forms_switchHorizontalAxe : Messages.forms_switchVerticalAxe );
});
return lines;