Skip to content

Commit 87e6368

Browse files
committed
Accessibility: add labeling for send button
1 parent e43e7e6 commit 87e6368

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Telegram/SourceFiles/ui/controls/send_button.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ For license and copyright information please follow this link:
1515
#include "styles/style_boxes.h"
1616
#include "styles/style_chat_helpers.h"
1717
#include "styles/style_credits.h"
18+
#include "lang/lang_keys.h"
19+
#include "ui/text/format_values.h"
1820

1921
namespace Ui {
2022
namespace {
@@ -60,6 +62,33 @@ void SendButton::setState(State state) {
6062
kMarkupTextOptions);
6163
}
6264
_state = state;
65+
QString accessibleName;
66+
switch (_state.type) {
67+
case Type::Send:
68+
accessibleName = tr::lng_send_button(tr::now); break;
69+
case Type::Record:
70+
accessibleName = tr::lng_shortcuts_record_voice_message(tr::now); break;
71+
case Type::Round:
72+
accessibleName = tr::lng_shortcuts_record_round_message(tr::now); break;
73+
case Type::Cancel:
74+
accessibleName = tr::lng_cancel(tr::now); break;
75+
case Type::Save:
76+
accessibleName = tr::lng_settings_save(tr::now); break;
77+
case Type::Slowmode:
78+
accessibleName = tr::lng_slowmode_enabled(
79+
tr::now,
80+
lt_left,
81+
Ui::FormatDurationWordsSlowmode(_state.slowmodeDelay)); break;
82+
case Type::Schedule:
83+
accessibleName = tr::lng_schedule_button(tr::now); break;
84+
case Type::EditPrice: break;
85+
default:
86+
break;
87+
}
88+
89+
if (!accessibleName.isEmpty()) {
90+
this->setAccessibleName(accessibleName);
91+
}
6392
if (animate) {
6493
_stateChangeFromWidth = width();
6594
_stateChangeAnimation.stop();

0 commit comments

Comments
 (0)