Skip to content

A platform for community discussion. Free, open, simple.

A11Y: makes edit username and avatar accessible (#12162)

Joffrey JAFFEUX0b14eb6ab1c4
diff --git a/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js b/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js
new file mode 100644
index 00000000000..807b58e39f6
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/initializers/ember-link-component-extension.js
@@ -0,0 +1,9 @@
+export default {
+ name: "ember-link-component-extensions",
+
+ initialize() {
+ Ember.LinkComponent.reopen({
+ attributeBindings: ["name"],
+ });
+ },
+};
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/account.hbs b/app/assets/javascripts/discourse/app/templates/preferences/account.hbs
index 62a7a4abe7f..36c7bf5e63f 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/account.hbs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/account.hbs
@@ -3,7 +3,7 @@
<div class="controls">
<span class="static">{{model.username}}</span>
{{#if model.can_edit_username}}
- {{#link-to "preferences.username" class="btn btn-default btn-small btn-icon pad-left no-text"}}
+ {{#link-to "preferences.username" name=(i18n "user.username.edit") class="btn btn-default btn-small btn-icon pad-left no-text"}}
{{d-icon "pencil-alt"}}
{{/link-to}}
{{/if}}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index b2843a7bb81..b78f1bc62ff 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -1323,6 +1323,7 @@ en:
checking: "Checking username availability..."
prefilled: "Email matches this registered username"
required: "Please enter a username"
+ edit: "Edit username"
locale:
title: "Interface language"
@@ -1558,6 +1559,7 @@ en:
title: "Profile Picture"
header_title: "profile, messages, bookmarks and preferences"
name_and_description: "%{name} - %{description}"
+ edit: "Edit Profile Picture"
title:
title: "Title"
none: "(none)"