Commit b6ea92c7 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1721645: Accessibility fix for Show more button in P&C

behatnotneeded

Change-Id: I6a051e24163f341d9dfff2d35826696b7ef7d7a2
parent dcacd279
...@@ -326,5 +326,10 @@ function pagination_showmore(btn) { ...@@ -326,5 +326,10 @@ function pagination_showmore(btn) {
jQuery('#' + btnid).on('click', function() { jQuery('#' + btnid).on('click', function() {
pagination_showmore(jQuery(this)); pagination_showmore(jQuery(this));
}); });
jQuery('#' + btnid).on('keydown', function(e) {
if (e.keyCode == $j.ui.keyCode.SPACE || e.keyCode == $j.ui.keyCode.ENTER) {
pagination_showmore(jQuery(this));
}
});
}); });
} }
...@@ -4306,13 +4306,20 @@ function build_showmore_pagination($params) { ...@@ -4306,13 +4306,20 @@ function build_showmore_pagination($params) {
$output .= ' data-offset="' . ((int) $params['offset'] + (int) $params['limit']) . '"'; $output .= ' data-offset="' . ((int) $params['offset'] + (int) $params['limit']) . '"';
$output .= ' data-group="' . (isset($params['group']) ? $params['group'] : '') . '"'; $output .= ' data-group="' . (isset($params['group']) ? $params['group'] : '') . '"';
$output .= ' data-jsonscript="' . $params['jsonscript'] . '"'; $output .= ' data-jsonscript="' . $params['jsonscript'] . '"';
$output .= ' data-institution="' . (isset($params['institution']) ? $params['institution'] : '') . '">'; $output .= ' data-institution="' . (isset($params['institution']) ? $params['institution'] : '') . '"';
$output .= ' tabindex="0">';
$output .= get_string('showmore', 'mahara') . '</div>' . "\n"; $output .= get_string('showmore', 'mahara') . '</div>' . "\n";
$output .= '</div>'; $output .= '</div>';
$js = 'jQuery("#' . $params['databutton'] . '").on("click", function() {'; $js = 'jQuery("#' . $params['databutton'] . '").on("click", function() {';
$js .= ' pagination_showmore(jQuery(this));'; $js .= ' pagination_showmore(jQuery(this));';
$js .= '});' . "\n"; $js .= '});' . "\n";
$js .= 'jQuery("#' . $params['databutton'] . '").on("keydown", function(e) {';
$js .= ' if (e.keyCode == $j.ui.keyCode.SPACE || e.keyCode == $j.ui.keyCode.ENTER) {';
$js .= ' pagination_showmore(jQuery(this));';
$js .= ' }';
$js .= '});' . "\n";
} }
return array('html' => $output, 'javascript' => $js); return array('html' => $output, 'javascript' => $js);
......
...@@ -49,7 +49,7 @@ $js .= '});'; ...@@ -49,7 +49,7 @@ $js .= '});';
$groupid = param_integer('group', 0); $groupid = param_integer('group', 0);
$institutionname = param_alphanum('institution', false); $institutionname = param_alphanum('institution', false);
$smarty = smarty(array('paginator')); $smarty = smarty(array('paginator', 'js/jquery/jquery-ui/js/jquery-ui.min.js'));
$smarty->assign('INLINEJAVASCRIPT', $js); $smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('views', $data->data); $smarty->assign('views', $data->data);
$smarty->assign('sitetemplate', View::SITE_TEMPLATE); $smarty->assign('sitetemplate', View::SITE_TEMPLATE);
......
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