UX: add screen reader support to notifications. (title attribute is ignored by screen readers)

This commit is contained in:
Neil Lalonde 2015-09-02 12:29:29 -04:00
parent a0dd0bf1af
commit 1fbc142b0c
2 changed files with 23 additions and 6 deletions

View File

@ -4,17 +4,19 @@ export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['notification.read', 'notification.is_warning'],
scope: function() {
name: function() {
var notificationType = this.get("notification.notification_type");
var lookup = this.site.get("notificationLookup");
var name = lookup[notificationType];
return lookup[notificationType];
}.property("notification.notification_type"),
if (name === "custom") {
scope: function() {
if (this.get("name") === "custom") {
return this.get("notification.data.message");
} else {
return "notifications." + name;
return "notifications." + this.get("name");
}
}.property("notification.notification_type"),
}.property("name"),
url: function() {
const it = this.get('notification');
@ -57,7 +59,7 @@ export default Ember.Component.extend({
const url = this.get('url');
if (url) {
buffer.push('<a href="' + url + '">' + text + '</a>');
buffer.push('<a href="' + url + '" alt="' + I18n.t('notifications.alt.' + this.get("name")) + '">' + text + '</a>');
} else {
buffer.push(text);
}

View File

@ -899,6 +899,21 @@ en:
linked: "<i title='linked post' class='fa fa-arrow-left'></i><p><span>{{username}}</span> {{description}}</p>"
granted_badge: "<i title='badge granted' class='fa fa-certificate'></i><p>Earned '{{description}}'</p>"
alt:
mentioned: "Mentioned by"
quoted: "Quoted by"
replied: "Replied"
posted: "Post by"
edited: "Edit your post by"
liked: "Liked your post"
private_message: "Private message from"
invited_to_private_message: "Invited to a private message from"
invited_to_topic: "Invited to a topic from"
invitee_accepted: "Invite accepted by"
moved_post: "Your post was moved by"
linked: "Link to your post"
granted_badge: "Badge granted"
popup:
mentioned: '{{username}} mentioned you in "{{topic}}" - {{site_title}}'
quoted: '{{username}} quoted you in "{{topic}}" - {{site_title}}'