@@ -318,7 +318,7 @@ function DragAndDropTemplates(configuration) {
318
318
319
319
return (
320
320
h ( 'div.feedback' , {
321
- attributes : { 'role' : 'group' , 'aria-label' : gettext ( 'Feedback' ) } ,
321
+ attributes : { 'role' : 'group' , 'aria-label' : gettext ( 'Feedback' ) , 'aria-live' : 'polite' } ,
322
322
style : { display : feedback_display }
323
323
} , [
324
324
h ( 'div.feedback-content' , [
@@ -424,7 +424,7 @@ function DragAndDropTemplates(configuration) {
424
424
iconClass = 'fa-spin fa-spinner' ;
425
425
}
426
426
return (
427
- h ( 'span.problem-action-button-wrapper' , { } , [
427
+ h ( 'span.problem-action-button-wrapper' , { attributes : { "aria-hidden" : options . disabled || false } } , [
428
428
h (
429
429
'button.problem-action-btn.btn-default.btn-small' ,
430
430
{
@@ -459,7 +459,7 @@ function DragAndDropTemplates(configuration) {
459
459
go_to_beginning_button_class += ' sr' ;
460
460
}
461
461
return (
462
- h ( "div.problem-action-buttons-wrapper" , { attributes : { 'role' : 'group' , 'aria-label' : gettext ( 'Actions' ) } } , [
462
+ h ( "div.problem-action-buttons-wrapper" , { } , [
463
463
sidebarButtonTemplate (
464
464
go_to_beginning_button_class ,
465
465
"fa-arrow-up" ,
@@ -1052,6 +1052,16 @@ function DragAndDropBlock(runtime, element, configuration) {
1052
1052
$root . find ( '.keyboard-help-dialog .modal-dismiss-button' ) . focus ( ) ;
1053
1053
} ;
1054
1054
1055
+ var focusSuccessFeedback = function ( ) {
1056
+ var $feedback = $element . find ( '.final' ) ;
1057
+ if ( $feedback . is ( ':visible' ) ) {
1058
+ $feedback . attr ( 'tabindex' , '-1' ) ;
1059
+ $feedback . focus ( ) ;
1060
+ return true ;
1061
+ } ;
1062
+ return false ;
1063
+ }
1064
+
1055
1065
var showKeyboardHelp = function ( evt ) {
1056
1066
var focusId = document . activeElement ;
1057
1067
evt . preventDefault ( ) ;
@@ -1320,6 +1330,17 @@ function DragAndDropBlock(runtime, element, configuration) {
1320
1330
}
1321
1331
} ;
1322
1332
1333
+ var focusSubmitButton = function ( ) {
1334
+ var submitButton = $root . find ( '.btn-brand.submit' ) . toArray ( ) ;
1335
+ if ( submitButton . length ) {
1336
+ submitButton [ 0 ] . focus ( ) ;
1337
+ }
1338
+ else {
1339
+ // In case there are is no submit button, we default focus to the first zone.
1340
+ $root . find ( '.target .zone' ) . first ( ) . focus ( ) ;
1341
+ }
1342
+ } ;
1343
+
1323
1344
var focusItemFeedbackPopup = function ( ) {
1324
1345
var popup = $root . find ( '.item-feedback-popup' ) ;
1325
1346
if ( popup . length && popup . is ( ":visible" ) ) {
@@ -1800,8 +1821,11 @@ function DragAndDropBlock(runtime, element, configuration) {
1800
1821
// Move focus the the close button of the feedback popup.
1801
1822
focusItemFeedbackPopup ( ) ;
1802
1823
} else {
1803
- // Next tab press should take us to the "Go to Beginning" button.
1804
- state . tab_to_go_to_beginning_button = true ;
1824
+ if ( $root . find ( '.item-bank .option[draggable=true]' ) . length ) {
1825
+ focusFirstDraggable ( ) ;
1826
+ } else {
1827
+ focusSubmitButton ( ) ;
1828
+ } ;
1805
1829
}
1806
1830
} )
1807
1831
. fail ( function ( data ) {
@@ -1829,7 +1853,7 @@ function DragAndDropBlock(runtime, element, configuration) {
1829
1853
applyState ( ) ;
1830
1854
1831
1855
if ( manually_closed ) {
1832
- focusFirstDraggable ( ) ;
1856
+ focusSuccessFeedback ( ) || focusFirstDraggable ( ) ;
1833
1857
}
1834
1858
} ;
1835
1859
@@ -1903,7 +1927,7 @@ function DragAndDropBlock(runtime, element, configuration) {
1903
1927
} ) . always ( function ( ) {
1904
1928
state . submit_spinner = false ;
1905
1929
applyState ( ) ;
1906
- focusItemFeedbackPopup ( ) || focusFirstDraggable ( ) ;
1930
+ focusItemFeedbackPopup ( ) || focusSuccessFeedback ( ) || focusFirstDraggable ( ) ;
1907
1931
} ) ;
1908
1932
} ;
1909
1933
0 commit comments