Skip to content

Commit

Permalink
MDL-74073 core_form: Set aria-expanded values for expand/collapse all
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Mar 16, 2022
1 parent ed0dacb commit 576020c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion course/renderer.php
Expand Up @@ -1699,7 +1699,7 @@ protected function coursecat_tree(coursecat_helper $chelper, $coursecat) {

// Only show the collapse/expand if there are children to expand.
$content .= html_writer::start_tag('div', array('class' => 'collapsible-actions'));
$content .= html_writer::link('#', $linkname, array('class' => implode(' ', $classes)));
$content .= html_writer::link('#', $linkname, array('class' => implode(' ', $classes), 'aria-expanded' => false));
$content .= html_writer::end_tag('div');
$this->page->requires->strings_for_js(array('collapseall', 'expandall'), 'moodle');
}
Expand Down
Expand Up @@ -228,9 +228,11 @@ Y.extend(SHORTFORMS, Y.Base, {
// Updating the button.
if (expandbtn) {
btn.removeClass(CSS.COLLAPSEALL);
btn.setAttribute('aria-expanded', false);
btn.setHTML(M.util.get_string('expandall', 'moodle'));
} else {
btn.addClass(CSS.COLLAPSEALL);
btn.setAttribute('aria-expanded', true);
btn.setHTML(M.util.get_string('collapseall', 'moodle'));
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -225,9 +225,11 @@ Y.extend(SHORTFORMS, Y.Base, {
// Updating the button.
if (expandbtn) {
btn.removeClass(CSS.COLLAPSEALL);
btn.setAttribute('aria-expanded', false);
btn.setHTML(M.util.get_string('expandall', 'moodle'));
} else {
btn.addClass(CSS.COLLAPSEALL);
btn.setAttribute('aria-expanded', true);
btn.setHTML(M.util.get_string('collapseall', 'moodle'));
}

Expand Down
2 changes: 2 additions & 0 deletions lib/form/yui/src/shortforms/js/shortforms.js
Expand Up @@ -226,9 +226,11 @@ Y.extend(SHORTFORMS, Y.Base, {
// Updating the button.
if (expandbtn) {
btn.removeClass(CSS.COLLAPSEALL);
btn.setAttribute('aria-expanded', false);
btn.setHTML(M.util.get_string('expandall', 'moodle'));
} else {
btn.addClass(CSS.COLLAPSEALL);
btn.setAttribute('aria-expanded', true);
btn.setHTML(M.util.get_string('collapseall', 'moodle'));
}

Expand Down

0 comments on commit 576020c

Please sign in to comment.