[a11y] Keeps keyboard focus in the + People modal

This makes it so that the third screen of the "Add People" modal
in courses maintains a focus point.  Prior to this commit focus
was lost when proceeding into the third step, eliminating the ability
to tab through to any buttons.  Now focus is set on the "Done" button
allowing tabbing throughout the modal.

closes CNVS-20788

Test Plan:
  - Go to the People section of a course
  - Click the "+ People" button
  - Fill in the steps proceeding through the screens
  - On the last screen, focus should be set to the "Done" button.
    This should allow you to focus through to all the other interactive
    elements of the modal.

Change-Id: Ie3fdfce381c04944c6a1eb5209ef8257ed0eede5
Reviewed-on: https://gerrit.instructure.com/55710
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
This commit is contained in:
Clay Diffrient 2015-06-04 09:38:37 -06:00
parent 6e597db481
commit b9db9b93af
3 changed files with 23 additions and 0 deletions

View File

@ -94,5 +94,7 @@ define [
@$('[placeholder]').placeholder()
@maybeShowPrivileges()
$('#user_email_errors').focus()
if @model.get('step') == 3
@$('button.dialog_closer').focus()

View File

@ -116,3 +116,13 @@ define [
view.open()
assertTextareaValue ''
# This test should work, it passes locally, but it doesn't work on
# Jenkins. Commenting it out for now, and using Selenium for now.
#
# test 'sets focus to the Done button on step 3', ->
# addUserText()
# goToStep2()
# goToStep3()
# assertStepVisible 3
# ok document.activeElement == $('button.dialog_closer')[0], 'Done button has focus'

View File

@ -98,6 +98,17 @@ describe "people" do
check_element_has_focus(fj('.group-categories-actions .btn-primary'))
end
it "should make sure focus is set to the 'Done' button when adding users" do
f('#addUsers').click
wait_for_ajaximations
f('#user_list_textarea').send_keys('student2@test.com')
f('#next-step').click
wait_for_ajaximations
f('#createUsersAddButton').click
wait_for_ajaximations
check_element_has_focus(f('.dialog_closer'))
end
it "should validate the main page" do
users = ff('.roster_user_name')
expect(users[1].text).to match @student_1.name