Skip to content

Commit 3b8b8ad

Browse files
committed
Accessibility: add labeling for send button
1 parent 155c4f4 commit 3b8b8ad

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Telegram/SourceFiles/ui/controls/send_button.cpp

Lines changed: 24 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,28 @@ void SendButton::setState(State state) {
6062
kMarkupTextOptions);
6163
}
6264
_state = state;
65+
66+
setAccessibleName([&] {
67+
switch (_state.type) {
68+
case Type::Send: return tr::lng_send_button(tr::now);
69+
case Type::Record:
70+
return tr::lng_shortcuts_record_voice_message(tr::now);
71+
case Type::Round:
72+
return tr::lng_shortcuts_record_round_message(tr::now);
73+
case Type::Cancel: return tr::lng_cancel(tr::now);
74+
case Type::Save: return tr::lng_settings_save(tr::now);
75+
case Type::Slowmode:
76+
return tr::lng_slowmode_enabled(
77+
tr::now,
78+
lt_left,
79+
Ui::FormatDurationWordsSlowmode(_state.slowmodeDelay));
80+
case Type::Schedule: return tr::lng_schedule_button(tr::now);
81+
case Type::EditPrice:
82+
return tr::lng_suggest_menu_edit_price(tr::now);
83+
}
84+
Unexpected("Send button type.");
85+
}());
86+
6387
if (animate) {
6488
_stateChangeFromWidth = width();
6589
_stateChangeAnimation.stop();

0 commit comments

Comments
 (0)