add id to allow focus of assigment menu
data-focus-returns-to was not working for move and edit actions since the id it was looking for didn't exist changed DialogFormView to ensure that close is called in the jquery ui dialog close callback-this means that focusReturnsTo will be called when using the ui close button or @el.dialog('close') made screenreader-only for the assignment menu come before the icons for consistency fixes CNVS-9235 test plan ========= - enable draft state - open the "Move To" or "Edit" dialog for an individual assignment - close the dialog either by saving or canceling - verify the focus returns to the cog menu for that assignment - verify the above works as expected with screenreaders Change-Id: I41e1ea07bfed6a1eb32b23a420949465bb023f8c Reviewed-on: https://gerrit.instructure.com/26002 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Simon Williams <simon@instructure.com> QA-Review: Amber Taniuchi <amber@instructure.com> Product-Review: Matthew Irish <mirish@instructure.com>
This commit is contained in:
parent
85114b790e
commit
93f1024855
|
@ -4,6 +4,7 @@ define [
|
|||
'compiled/fn/preventDefault'
|
||||
'jst/DialogFormWrapper'
|
||||
'jqueryui/dialog'
|
||||
'compiled/jquery/fixDialogButtons'
|
||||
], ($, ValidatedFormView, preventDefault, wrapper) ->
|
||||
|
||||
##
|
||||
|
@ -71,7 +72,10 @@ define [
|
|||
##
|
||||
# @api public
|
||||
close: ->
|
||||
@dialog.close()
|
||||
# could be calling this from the close event
|
||||
# so we want to check if it's open
|
||||
if @dialog?.isOpen()
|
||||
@dialog.close()
|
||||
@focusReturnsTo()?.focus()
|
||||
|
||||
##
|
||||
|
@ -166,7 +170,9 @@ define [
|
|||
opts =
|
||||
autoOpen: false
|
||||
title: @getDialogTitle()
|
||||
close: => @trigger 'close'
|
||||
close: =>
|
||||
@close()
|
||||
@trigger 'close'
|
||||
open: => @trigger 'open'
|
||||
opts.width = @options.width
|
||||
opts.height = @options.height
|
||||
|
|
|
@ -59,13 +59,14 @@
|
|||
|
||||
<a
|
||||
class="al-trigger al-trigger-gray"
|
||||
id="assign_{{id}}_manage_link"
|
||||
role="button"
|
||||
aria-haspopup="true"
|
||||
aria-owns="assignment_{{id}}_settings_list"
|
||||
tabindex="-1"
|
||||
>
|
||||
<i class="icon-settings"></i><i class="icon-mini-arrow-down"></i>
|
||||
<span class="screenreader-only">{{#t "settings"}}Settings{{/t}}</span>
|
||||
<i class="icon-settings"></i><i class="icon-mini-arrow-down"></i>
|
||||
</a>
|
||||
|
||||
<ul
|
||||
|
|
|
@ -11,6 +11,7 @@ define [
|
|||
view = null
|
||||
model = null
|
||||
trigger = null
|
||||
closeSpy = null
|
||||
|
||||
# helpers
|
||||
openDialog = ->
|
||||
|
@ -23,6 +24,7 @@ define [
|
|||
|
||||
module 'DialogFormView',
|
||||
setup: ->
|
||||
closeSpy = sinon.spy DialogFormView::, 'close'
|
||||
server = sinon.fakeServer.create()
|
||||
model = new Backbone.Model id:1, is_awesome: true
|
||||
model.url = '/test'
|
||||
|
@ -42,6 +44,7 @@ define [
|
|||
teardown: ->
|
||||
trigger.remove()
|
||||
server.restore()
|
||||
closeSpy.restore()
|
||||
view.remove()
|
||||
|
||||
test 'opening and closing the dialog with the trigger', ->
|
||||
|
@ -99,4 +102,9 @@ define [
|
|||
equal view.$el.find('.outlet').html(), 'hello',
|
||||
"renders template into outlet"
|
||||
|
||||
test 'closing the dialog calls view#close', ->
|
||||
openDialog()
|
||||
util.closeDialog()
|
||||
ok closeSpy.called
|
||||
|
||||
|
||||
|
|
|
@ -227,6 +227,18 @@ define [
|
|||
'sets correct non-screenreader text for not yet graded'
|
||||
ok nonScreenreaderText().match('Not Yet Graded')[0]
|
||||
|
||||
test "focus returns to cog after dismissing dialog", ->
|
||||
view = createView(@model, canManage: true)
|
||||
trigger = view.$("#assign_#{@model.id}_manage_link")
|
||||
ok(trigger.length, 'there is an a node with the correct id')
|
||||
#show menu
|
||||
trigger.click()
|
||||
|
||||
view.$("#assignment_#{@model.id}_settings_edit_item").click()
|
||||
view.editAssignmentView.close()
|
||||
|
||||
equal document.activeElement, trigger.get(0)
|
||||
|
||||
|
||||
module 'AssignmentListItemViewSpec—alternate grading type: percent',
|
||||
setup: ->
|
||||
|
@ -296,3 +308,5 @@ define [
|
|||
|
||||
equal screenreaderText(), 'This assignment will not be assigned a grade.', 'sets screenreader text'
|
||||
equal nonScreenreaderText(), '', 'sets non-screenreader text'
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue