FIX(a11y): Explicitly set the accessible name of "Next" and "Back" buttons in wizards

For some or all screen readers the "Next >" and "Back <" buttons
in wizards read out the ">" and "<" symbols which is rather annoying.

This commit explicitly sets the accessible name attribute such that
the buttons are read without the symbols.
This commit is contained in:
Hartmnt 2022-11-29 16:41:08 +00:00
parent caa1490102
commit 9d281c0e04
4 changed files with 15 additions and 0 deletions

View File

@ -5,6 +5,9 @@
#include "Accessibility.h"
#include <QAbstractButton>
#include <QObject>
namespace Mumble {
namespace Accessibility {
@ -12,5 +15,10 @@ namespace Accessibility {
widget->setAccessibleDescription(label->text().remove(QRegExp("<[^>]*>")));
}
void fixWizardButtonLabels(QWizard *wizard) {
wizard->button(QWizard::NextButton)->setAccessibleName(QObject::tr("Next"));
wizard->button(QWizard::BackButton)->setAccessibleName(QObject::tr("Back"));
}
} // namespace Accessibility
} // namespace Mumble

View File

@ -8,11 +8,13 @@
#include <QLabel>
#include <QWidget>
#include <QWizard>
namespace Mumble {
namespace Accessibility {
void setDescriptionFromLabel(QWidget *widget, const QLabel *label);
void fixWizardButtonLabels(QWizard *wizard);
} // namespace Accessibility
} // namespace Mumble

View File

@ -38,6 +38,8 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
qsMaxAmp->setAccessibleName(tr("Maximum amplification"));
qsVAD->setAccessibleName(tr("VAD level"));
Mumble::Accessibility::fixWizardButtonLabels(this);
Mumble::Accessibility::setDescriptionFromLabel(qrbQualityLow, qlQualityLow);
Mumble::Accessibility::setDescriptionFromLabel(qrbQualityBalanced, qlQualityBalanced);
Mumble::Accessibility::setDescriptionFromLabel(qrbQualityUltra, qlQualityUltra);

View File

@ -13,6 +13,7 @@
#include "Cert.h"
#include "Accessibility.h"
#include "SelfSignedCertificate.h"
#include "Utils.h"
#include "Global.h"
@ -131,6 +132,8 @@ CertWizard::CertWizard(QWidget *p) : QWizard(p) {
qleEmail->setAccessibleName(tr("Email address"));
qleName->setAccessibleName(tr("Your name"));
Mumble::Accessibility::fixWizardButtonLabels(this);
setOption(QWizard::NoCancelButton, false);
qwpExport->setCommitPage(true);