Skip to content

Commit 13e0224

Browse files
author
Andrew Butterfield
committed
Close buttons in list are more friendly to a11y
fixes CNVS-19259 Test plan: * Generate a thread of conversation messages between a number of users * if you don't have one already * Navigate to Inbox * Click on a message that has a string of replies * Open the reply modal of this message * Ensure that when you press enter or space bar (via keyboard) when the the circle x's of context messages have focus that the following behavior occurs * If focus is on the circle x of the top context message and you press space bar or enter, focus should go to the circle x of the next context message * If focus is on the circle x of a context message that has context messages before it and you press space bar or enter, focus should go to the circle x of the context message just before it * If focus is on the circle x of the last context message and you press space bar or enter, focus should go to the attachments button in the footer of the modal * Ensure that this behavior still occurs when navigating the modal using * a screen reader Change-Id: Iad596b76fe0c30abb785e9287938b87d973673de Reviewed-on: https://gerrit.instructure.com/50675 Tested-by: Jenkins Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com> QA-Review: Derek Hansen <dhansen@instructure.com> Product-Review: Cosme Salazar <cosme@instructure.com>
1 parent 9df3934 commit 13e0224

5 files changed

Lines changed: 36 additions & 2 deletions

File tree

app/coffeescripts/views/conversations/ContextMessageView.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define [
1111

1212
events:
1313
'click a.context-more': 'toggle'
14-
'click a.delete-btn': 'remove'
14+
'click .delete-btn': 'triggerRemoval'
1515

1616
initialize: ->
1717
super
@@ -29,3 +29,6 @@ define [
2929
@model.set(isCondensed: !@model.get('isCondensed'))
3030
@render()
3131
@$('a').focus()
32+
33+
triggerRemoval: ->
34+
@model.trigger("removeView", { view: @ })

app/coffeescripts/views/conversations/ContextMessagesView.coffee

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,24 @@ define [
55

66
class ContextMessagesView extends CollectionView
77
itemView: ContextMessageView
8+
9+
initialize: (options) ->
10+
super
11+
@collection.each (model) =>
12+
model.bind("removeView", @handleChildViewRemoval)
13+
14+
handleChildViewRemoval: (e) ->
15+
el = e.view.$el
16+
index = el.index()
17+
hasSiblings = el.siblings().length > 0
18+
prev = el.prev().find('.delete-btn')
19+
next = el.next().find('.delete-btn')
20+
e.view.remove()
21+
22+
if (index > 0)
23+
prev.focus()
24+
else
25+
if (hasSiblings)
26+
next.focus()
27+
else
28+
$('#add-message-attachment-button').focus()

app/stylesheets/pages/conversations/_compose_message_dialog.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ $subtleBorderColor: #e5e5e5;
292292
margin-top: 7px;
293293
clear: both;
294294
}
295+
296+
.delete-btn {
297+
background: none;
298+
color: #555;
299+
border: none;
300+
padding: 0px;
301+
}
295302
}
296303

297304
}

app/views/jst/conversations/composeButtonBar.handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="ui-dialog-buttonset attachments">
22
<{{#if isIE10}}label for="file_input" role="button"{{else}}button{{/if}}
3+
id="add-message-attachment-button"
34
class="ui-button ui-widget ui-state-default ui-corner-all attach-file"
45
type="button"
56
title="{{#t "titles.add_attachment"}}Add an attachment{{/t}}">

app/views/jst/conversations/contextMessage.handlebars

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<div class="context-author pull-left">{{author.name}}</div>
33
<div class="pull-right">
44
<span class="context-date">{{friendlyDatetime created_at}}</span>
5-
<a class="icon-x delete-btn" href="#" aria-label="{{#t "delete_message"}}Delete message{{/t}}"></a>
5+
<button type="button" class="delete-btn" href="#" aria-label="{{#t "delete_message"}}Delete message{{/t}}">
6+
<i class="icon-end"></i>
7+
</button>
68
</ul>
79
</div>
810
<div class="context-body" aria-live="polite">

0 commit comments

Comments
 (0)