Commit 81798dd8 by Greg Price

Improve accessibility of inline discussions

The show/hide toggle now properly acts like a button, and focus is now
trapped on the loading element for both the show/hide action and loading
of a new page.
parent a0fa9d0b
...@@ -20,6 +20,8 @@ Studio: Continued modification of Studio pages to follow a RESTful framework. ...@@ -20,6 +20,8 @@ Studio: Continued modification of Studio pages to follow a RESTful framework.
includes Settings pages, edit page for Subsection and Unit, and interfaces includes Settings pages, edit page for Subsection and Unit, and interfaces
for updating xblocks (xmodules) and getting their editing HTML. for updating xblocks (xmodules) and getting their editing HTML.
LMS: Improve accessibility of inline discussions in courseware.
Blades: Put 2nd "Hide output" button at top of test box & increase text size for Blades: Put 2nd "Hide output" button at top of test box & increase text size for
code response questions. BLD-126. code response questions. BLD-126.
......
...@@ -2,6 +2,8 @@ if Backbone? ...@@ -2,6 +2,8 @@ if Backbone?
class @DiscussionModuleView extends Backbone.View class @DiscussionModuleView extends Backbone.View
events: events:
"click .discussion-show": "toggleDiscussion" "click .discussion-show": "toggleDiscussion"
"keypress .discussion-show":
(event) -> DiscussionUtil.activateOnEnter(event, toggleDiscussion)
"click .new-post-btn": "toggleNewPost" "click .new-post-btn": "toggleNewPost"
"click .new-post-cancel": "hideNewPost" "click .new-post-cancel": "hideNewPost"
"click .discussion-paginator a": "navigateToPage" "click .discussion-paginator a": "navigateToPage"
...@@ -70,6 +72,7 @@ if Backbone? ...@@ -70,6 +72,7 @@ if Backbone?
DiscussionUtil.safeAjax DiscussionUtil.safeAjax
$elem: $elem $elem: $elem
$loading: $elem $loading: $elem
takeFocus: true
url: url url: url
type: "GET" type: "GET"
dataType: 'json' dataType: 'json'
...@@ -77,6 +80,7 @@ if Backbone? ...@@ -77,6 +80,7 @@ if Backbone?
error: error error: error
renderDiscussion: ($elem, response, textStatus, discussionId) => renderDiscussion: ($elem, response, textStatus, discussionId) =>
$elem.focus()
window.user = new DiscussionUser(response.user_info) window.user = new DiscussionUser(response.user_info)
Content.loadContentInfos(response.annotated_content_info) Content.loadContentInfos(response.annotated_content_info)
DiscussionUtil.loadRoles(response.roles) DiscussionUtil.loadRoles(response.roles)
......
...@@ -2,9 +2,12 @@ $ -> ...@@ -2,9 +2,12 @@ $ ->
if !window.$$contents if !window.$$contents
window.$$contents = {} window.$$contents = {}
$.fn.extend $.fn.extend
loading: -> loading: (takeFocus) ->
@$_loading = $("<div class='loading-animation'><span class='sr'>Loading content</span></div>") @$_loading = $("<div class='loading-animation' tabindex='0'><span class='sr'>Loading content</span></div>")
$(this).after(@$_loading) $(this).after(@$_loading)
if takeFocus
DiscussionUtil.makeFocusTrap(@$_loading)
@$_loading.focus()
loaded: -> loaded: ->
@$_loading.remove() @$_loading.remove()
...@@ -132,7 +135,7 @@ class @DiscussionUtil ...@@ -132,7 +135,7 @@ class @DiscussionUtil
if params["loadingCallback"]? if params["loadingCallback"]?
params["loadingCallback"].apply(params["$loading"]) params["loadingCallback"].apply(params["$loading"])
else else
params["$loading"].loading() params["$loading"].loading(params["takeFocus"])
if !params["error"] if !params["error"]
params["error"] = => params["error"] = =>
@discussionAlert( @discussionAlert(
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
<%include file="_underscore_templates.html" /> <%include file="_underscore_templates.html" />
<div class="discussion-module" data-discussion-id="${discussion_id | h}"> <div class="discussion-module" data-discussion-id="${discussion_id | h}">
<a class="discussion-show control-button" href="javascript:void(0)" data-discussion-id="${discussion_id | h}"><span class="show-hide-discussion-icon"></span><span class="button-text">Show Discussion</span></a> <a class="discussion-show control-button" href="javascript:void(0)" data-discussion-id="${discussion_id | h}" role="button"><span class="show-hide-discussion-icon"></span><span class="button-text">Show Discussion</span></a>
<a href="#" class="new-post-btn"><span class="icon icon-edit new-post-icon"></span>${_("New Post")}</a> <a href="#" class="new-post-btn"><span class="icon icon-edit new-post-icon"></span>${_("New Post")}</a>
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment