Commit 66f909cd by Chris Rodriguez

Assigning regions to forum areas and adding ARIA to new post form

parent ebc86895
...@@ -29,7 +29,7 @@ if Backbone? ...@@ -29,7 +29,7 @@ if Backbone?
if @showed if @showed
@newPostForm.slideDown(300) @newPostForm.slideDown(300)
else else
@newPostForm.show() @newPostForm.show().focus()
@toggleDiscussionBtn.addClass('shown') @toggleDiscussionBtn.addClass('shown')
@toggleDiscussionBtn.find('.button-text').html(gettext("Hide Discussion")) @toggleDiscussionBtn.find('.button-text').html(gettext("Hide Discussion"))
@$("section.discussion").slideDown() @$("section.discussion").slideDown()
...@@ -128,7 +128,7 @@ if Backbone? ...@@ -128,7 +128,7 @@ if Backbone?
@renderPagination(response.num_pages) @renderPagination(response.num_pages)
if @isWaitingOnNewPost if @isWaitingOnNewPost
@newPostForm.show() @newPostForm.show().focus()
addThread: (thread, collection, options) => addThread: (thread, collection, options) =>
# TODO: When doing pagination, this will need to repaginate. Perhaps just reload page 1? # TODO: When doing pagination, this will need to repaginate. Perhaps just reload page 1?
......
...@@ -79,13 +79,12 @@ if Backbone? ...@@ -79,13 +79,12 @@ if Backbone?
$('.forum-content').fadeOut( $('.forum-content').fadeOut(
duration: 200 duration: 200
complete: => complete: =>
@newPost.fadeIn(200) @newPost.fadeIn(200).focus()
$('.new-post-title').focus()
) )
hideNewPost: => hideNewPost: =>
@newPost.fadeOut( @newPost.fadeOut(
duration: 200 duration: 200
complete: => complete: =>
$('.forum-content').fadeIn(200) $('.forum-content').fadeIn(200).find('.thread-wrapper').focus()
) )
...@@ -144,6 +144,7 @@ if Backbone? ...@@ -144,6 +144,7 @@ if Backbone?
) )
@trigger "thread:responses:rendered" @trigger "thread:responses:rendered"
@loadedResponses = true @loadedResponses = true
$(".thread-wrapper").focus() # Sends focus to the conversation once the thread finishes loading
error: (xhr, textStatus) => error: (xhr, textStatus) =>
return if textStatus == 'abort' return if textStatus == 'abort'
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
## common/static/coffee/spec/discussion_spec_helper.coffee is changed and regenerated, whenever this one changes. ## common/static/coffee/spec/discussion_spec_helper.coffee is changed and regenerated, whenever this one changes.
<script aria-hidden="true" type="text/template" id="thread-template"> <script aria-hidden="true" type="text/template" id="thread-template">
<article class="discussion-article" data-id="${'<%- id %>'}"> <article class="discussion-article" data-id="${'<%- id %>'}">
<div class="thread-wrapper"> <div class="thread-wrapper" tabindex="-1">
<div class="forum-thread-main-wrapper"> <div class="forum-thread-main-wrapper">
<div class="thread-content-wrapper"></div> <div class="thread-content-wrapper"></div>
<div class="post-extended-content"> <div class="post-extended-content">
...@@ -392,13 +392,13 @@ ...@@ -392,13 +392,13 @@
<span class="field-label-text"> <span class="field-label-text">
## Translators: This labels the selector for which group of students can view a post ## Translators: This labels the selector for which group of students can view a post
${_("Visible To:")} ${_("Visible To:")}
</span><select class="field-input js-group-select" name="group_id" ${'<% if (!is_commentable_cohorted) { %>'}disabled${'<% } %>'}> </span><select aria-describedby="field_help_visible_to" class="field-input js-group-select" name="group_id" ${'<% if (!is_commentable_cohorted) { %>'}disabled${'<% } %>'}>
<option value="">${_("All Groups")}</option> <option value="">${_("All Groups")}</option>
${'<% _.each(cohort_options, function(opt) { %>'} ${'<% _.each(cohort_options, function(opt) { %>'}
<option value="${'<%= opt.value %>'}" ${'<% if (opt.selected) { %>selected<% } %>'}>${'<%- opt.text %>'}</option> <option value="${'<%= opt.value %>'}" ${'<% if (opt.selected) { %>selected<% } %>'}>${'<%- opt.text %>'}</option>
${'<% }); %>'} ${'<% }); %>'}
</select> </select>
</label><div class="field-help"> </label><div class="field-help" id="field_help_visible_to">
${_("Discussion admins, moderators, and TAs can make their posts visible to all students or specify a single cohort.")} ${_("Discussion admins, moderators, and TAs can make their posts visible to all students or specify a single cohort.")}
</div> </div>
</div> </div>
...@@ -406,8 +406,8 @@ ...@@ -406,8 +406,8 @@
<div class="post-field"> <div class="post-field">
<label class="field-label"> <label class="field-label">
<span class="sr">${_("Title:")}</span> <span class="sr">${_("Title:")}</span>
<input type="text" class="field-input js-post-title" name="title" placeholder="${_('Title')}"> <input aria-describedby="field_help_title" type="text" class="field-input js-post-title" name="title" placeholder="${_('Title')}">
</label><span class="field-help"> </label><span class="field-help" id="field_help_title">
${_("Add a clear and descriptive title to encourage participation.")} ${_("Add a clear and descriptive title to encourage participation.")}
</span> </span>
</div> </div>
...@@ -444,21 +444,21 @@ ...@@ -444,21 +444,21 @@
## Translators: This is the label for a control to ## Translators: This is the label for a control to
## select a forum post type ## select a forum post type
${_("Post type:")} ${_("Post type:")}
</span><fieldset class="field-input"> </span><fieldset class="field-input"><legend class="sr">${_("Post type:")}</legend>
<input type="radio" name="${"<%= form_id %>"}-post-type" class="post-type-input" id="${"<%= form_id %>"}-post-type-question" value="question"> <input aria-describedby="field_help_post_type" type="radio" name="${"<%= form_id %>"}-post-type" class="post-type-input" id="${"<%= form_id %>"}-post-type-question" value="question">
<label for="${"<%= form_id %>"}-post-type-question" class="post-type-label"> <label for="${"<%= form_id %>"}-post-type-question" class="post-type-label">
<i class="icon fa fa-question"></i> <i class="icon fa fa-question"></i>
## Translators: This is a forum post type ## Translators: This is a forum post type
${_("Question")} ${_("Question")}
</label> </label>
<input type="radio" name="${"<%= form_id %>"}-post-type" class="post-type-input" id="${"<%= form_id %>"}-post-type-discussion" value="discussion" checked> <input aria-describedby="field_help_post_type" type="radio" name="${"<%= form_id %>"}-post-type" class="post-type-input" id="${"<%= form_id %>"}-post-type-discussion" value="discussion" checked>
<label for="${"<%= form_id %>"}-post-type-discussion" class="post-type-label"> <label for="${"<%= form_id %>"}-post-type-discussion" class="post-type-label">
<i class="icon fa fa-comments"></i> <i class="icon fa fa-comments"></i>
## Translators: This is a forum post type ## Translators: This is a forum post type
${_("Discussion")} ${_("Discussion")}
</label> </label>
</fieldset> </fieldset>
</div><span class="field-help"> </div><span class="field-help" id="field_help_post_type">
${_("Questions raise issues that need answers. Discussions share ideas and start conversations.")} ${_("Questions raise issues that need answers. Discussions share ideas and start conversations.")}
</span> </span>
</div> </div>
...@@ -489,12 +489,12 @@ ...@@ -489,12 +489,12 @@
<div class="topic-menu-wrapper"> <div class="topic-menu-wrapper">
<label class="topic-filter-label"> <label class="topic-filter-label">
<span class="sr">${_("Filter topics")}</span> <span class="sr">${_("Filter topics")}</span>
<input type="text" class="topic-filter-input" placeholder="${_('Filter topics')}"> <input aria-describedby="field_help_topic_area" type="text" class="topic-filter-input" placeholder="${_('Filter topics')}">
</label> </label>
<ul class="topic-menu" role="menu">${'<%= topics_html %>'}</ul> <ul class="topic-menu" role="menu">${'<%= topics_html %>'}</ul>
</div> </div>
</div> </div>
</div><span class="field-help"> </div><span class="field-help" id="field_help_topic_area">
${_("Add your post to a relevant topic to help others find it.")} ${_("Add your post to a relevant topic to help others find it.")}
</span> </span>
</script> </script>
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
data-user-cohort-id="${user_cohort}" data-user-cohort-id="${user_cohort}"
data-course-settings="${course_settings}"> data-course-settings="${course_settings}">
<div class="discussion-body"> <div class="discussion-body">
<div class="forum-nav"></div> <div class="forum-nav" role="complementary" aria-label="Discussion thread list"></div>
<div class="discussion-column"> <div class="discussion-column" role="main" aria-label="Discussion" id="discussion-column">
<article class="new-post-article" style="display: none"></article> <article class="new-post-article" style="display: none" tabindex="-1" aria-label="New topic form"></article>
<div class="forum-content"></div> <div class="forum-content"></div>
</div> </div>
</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