toodego: a11y, add explicit links for toggling group titles (#34678)

This commit is contained in:
Frédéric Péters 2019-07-10 10:16:22 +02:00
parent 7e9072d4c5
commit 0709780110
2 changed files with 26 additions and 0 deletions

View File

@ -203,6 +203,14 @@ div.cell h2 {
span.remove::after {
content: "\f00d"; /* times */
}
a.a11y-toggle-link {
position: absolute;
right: 5px;
top: 5px;
bottom: 5px;
width: 40px;
display: block;
}
}
}
@ -215,6 +223,9 @@ div.cell h2 {
pointer-events: all;
opacity: 1;
}
a.a11y-toggle-link {
display: none;
}
}
}

View File

@ -933,4 +933,19 @@ $(function() {
init_gallery_cell();
}
});
function init_group_titles_for_a11y() {
$('.group-title h2').each(function(idx, elem) {
if ($(elem).find('.a11y-toggle-link').length) return;
$(elem).append('<a class="a11y-toggle-link" href=""><span class="sr-only">plier/déplier la section</span></a>')
});
}
init_group_titles_for_a11y();
$(document).on('combo:cell-loaded', function(ev, elem) {
if ($(elem).find('.group-title')) {
init_group_titles_for_a11y();
}
});
});