Discussions: Make Screen Readers read the number of replies and unread replies

Fixes CNVS-11719

Test plan:
* Using a screen reader, visit a discussion page, with and without replies,
  and with and without unread replies.
* Verify that the number of replies and number of unread replies are read,
  with context (I.E. text that says what the numbers refer to).

Change-Id: Iab57637c162fec04ca3fcb3c1681e42955ec384a
Reviewed-on: https://gerrit.instructure.com/31875
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Aaron Cannon <acannon@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
This commit is contained in:
Aaron Cannon 2014-03-13 16:00:33 -05:00
parent 26816a3334
commit b2f1078ec3
1 changed files with 23 additions and 6 deletions

View File

@ -1,17 +1,34 @@
<div class="new-and-total-badge">
<span class="new-items"
aria-hidden="true"
data-tooltip
data-bind='{"title":"unreadText", "text":"unreadCount"}'
title="<%= t('unread_count_tooltip', {
:zero => 'No unread replies',
:one => '1 unread reply',
:other => '%{count} unread replies'
:zero => 'No unread replies.',
:one => '1 unread reply.',
:other => '%{count} unread replies.'
}, :count => unread_count) %>"><%= unread_count if unread_count > 0 %></span>
<span class="screenreader-only"
data-bind='{"text":"unreadText"}'>
<%= t('unread_count_tooltip', {
:zero => 'No unread replies.',
:one => '1 unread reply.',
:other => '%{count} unread replies.'
}, :count => unread_count) %>
</span>
<span class="total-items"
aria-hidden="true"
data-tooltip
title="<%= t('reply_count_tooltip', {
:zero => 'No replies',
:one => '1 reply',
:other => '%{count} replies'
:zero => 'No replies.',
:one => '1 reply.',
:other => '%{count} replies.'
}, :count => reply_count) %>"><%= reply_count if reply_count > 0 %></span>
<span class="screenreader-only">
<%= t('reply_count_tooltip', {
:zero => 'No replies.',
:one => '1 reply.',
:other => '%{count} replies.'
}, :count => reply_count) %>
</span>
</div>