mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-52008 accessibility: Skip link works with chrome vox.
This commit is contained in:
parent
4cef723c22
commit
9e8d0842ba
30
index.php
30
index.php
@ -205,9 +205,9 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
$newsforumcontext = context_module::instance($newsforumcm->id, MUST_EXIST);
|
||||
|
||||
$forumname = format_string($newsforum->name, true, array('context' => $newsforumcontext));
|
||||
echo html_writer::link('#',
|
||||
echo html_writer::link('#skipsitenews',
|
||||
get_string('skipa', 'access', core_text::strtolower(strip_tags($forumname))),
|
||||
array('data-target' => '#skipsitenews', 'class' => 'skip-block skip'));
|
||||
array('class' => 'skip-block skip'));
|
||||
|
||||
// Wraps site news forum in div container.
|
||||
echo html_writer::start_tag('div', array('id' => 'site-news-forum'));
|
||||
@ -234,16 +234,16 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
// End site news forum div container.
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipsitenews', 'tabindex' => '-1'));
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipsitenews'));
|
||||
}
|
||||
break;
|
||||
|
||||
case FRONTPAGEENROLLEDCOURSELIST:
|
||||
$mycourseshtml = $courserenderer->frontpage_my_courses();
|
||||
if (!empty($mycourseshtml)) {
|
||||
echo html_writer::link('#',
|
||||
echo html_writer::link('#skipmycourses',
|
||||
get_string('skipa', 'access', core_text::strtolower(get_string('mycourses'))),
|
||||
array('data-target' => '#skipmycourses', 'class' => 'skip skip-block'));
|
||||
array('class' => 'skip skip-block'));
|
||||
|
||||
// Wrap frontpage course list in div container.
|
||||
echo html_writer::start_tag('div', array('id' => 'frontpage-course-list'));
|
||||
@ -254,7 +254,7 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
// End frontpage course list div container.
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipmycourses', 'tabindex' => '-1'));
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipmycourses'));
|
||||
break;
|
||||
}
|
||||
// No "break" here. If there are no enrolled courses - continue to 'Available courses'.
|
||||
@ -262,9 +262,9 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
case FRONTPAGEALLCOURSELIST:
|
||||
$availablecourseshtml = $courserenderer->frontpage_available_courses();
|
||||
if (!empty($availablecourseshtml)) {
|
||||
echo html_writer::link('#',
|
||||
echo html_writer::link('#skipavailablecourses',
|
||||
get_string('skipa', 'access', core_text::strtolower(get_string('availablecourses'))),
|
||||
array('data-target' => '#skipavailablecourses', 'class' => 'skip skip-block'));
|
||||
array('class' => 'skip skip-block'));
|
||||
|
||||
// Wrap frontpage course list in div container.
|
||||
echo html_writer::start_tag('div', array('id' => 'frontpage-course-list'));
|
||||
@ -275,14 +275,14 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
// End frontpage course list div container.
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipavailablecourses', 'tabindex' => '-1'));
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipavailablecourses'));
|
||||
}
|
||||
break;
|
||||
|
||||
case FRONTPAGECATEGORYNAMES:
|
||||
echo html_writer::link('#',
|
||||
echo html_writer::link('#skipcategories',
|
||||
get_string('skipa', 'access', core_text::strtolower(get_string('categories'))),
|
||||
array('data-target' => '#skipcategories', 'class' => 'skip skip-block'));
|
||||
array('class' => 'skip skip-block'));
|
||||
|
||||
// Wrap frontpage category names in div container.
|
||||
echo html_writer::start_tag('div', array('id' => 'frontpage-category-names'));
|
||||
@ -293,13 +293,13 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
// End frontpage category names div container.
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipcategories', 'tabindex' => '-1'));
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipcategories'));
|
||||
break;
|
||||
|
||||
case FRONTPAGECATEGORYCOMBO:
|
||||
echo html_writer::link('#',
|
||||
echo html_writer::link('#skipcourses',
|
||||
get_string('skipa', 'access', core_text::strtolower(get_string('courses'))),
|
||||
array('data-target' => '#skipcourses', 'class' => 'skip skip-block'));
|
||||
array('class' => 'skip skip-block'));
|
||||
|
||||
// Wrap frontpage category combo in div container.
|
||||
echo html_writer::start_tag('div', array('id' => 'frontpage-category-combo'));
|
||||
@ -310,7 +310,7 @@ foreach (explode(',', $frontpagelayout) as $v) {
|
||||
// End frontpage category combo div container.
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipcourses', 'tabindex' => '-1'));
|
||||
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipcourses'));
|
||||
break;
|
||||
|
||||
case FRONTPAGECOURSESEARCH:
|
||||
|
@ -1838,7 +1838,9 @@ M.util.init_skiplink = function(Y) {
|
||||
Y.one(Y.config.doc.body).delegate('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
Y.one(this.getAttribute('data-target')).focus();
|
||||
var node = Y.one(this.getAttribute('href'));
|
||||
node.setAttribute('tabindex', '-1');
|
||||
node.focus();
|
||||
return true;
|
||||
}, 'a.skip');
|
||||
};
|
||||
|
@ -1394,11 +1394,10 @@ class core_renderer extends renderer_base {
|
||||
$output = '';
|
||||
$skipdest = '';
|
||||
} else {
|
||||
$output = html_writer::link('#', get_string('skipa', 'access', $skiptitle),
|
||||
array('class' => 'skip skip-block', 'id'=>'fsb-' . $bc->skipid,
|
||||
'data-target' => '#sb-'.$bc->skipid));
|
||||
$output = html_writer::link('#sb-'.$bc->skipid, get_string('skipa', 'access', $skiptitle),
|
||||
array('class' => 'skip skip-block', 'id' => 'fsb-' . $bc->skipid));
|
||||
$skipdest = html_writer::span('', 'skip-block-to',
|
||||
array('id' => 'sb-' . $bc->skipid, 'tabindex' => '-1'));
|
||||
array('id' => 'sb-' . $bc->skipid));
|
||||
}
|
||||
|
||||
$output .= html_writer::start_tag('div', $bc->attributes);
|
||||
@ -2963,7 +2962,7 @@ EOD;
|
||||
* @return string the HTML to output.
|
||||
*/
|
||||
public function skip_link_target($id = null) {
|
||||
return html_writer::span('', '', array('id' => $id, 'tabindex' => '-1'));
|
||||
return html_writer::span('', '', array('id' => $id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1541,8 +1541,7 @@ class page_requirements_manager {
|
||||
$links = '';
|
||||
$attributes = array('class' => 'skip');
|
||||
foreach ($this->skiplinks as $url => $text) {
|
||||
$attributes['data-target'] = '#'.$url;
|
||||
$links .= html_writer::link('#', $text, $attributes);
|
||||
$links .= html_writer::link('#'.$url, $text, $attributes);
|
||||
}
|
||||
$output = html_writer::tag('div', $links, array('class'=>'skiplinks')) . "\n";
|
||||
$this->js_init_call('M.util.init_skiplink');
|
||||
|
Loading…
x
Reference in New Issue
Block a user