This commit is contained in:
kojix2
2024-12-26 00:02:39 +00:00
parent bc746749a3
commit ce41df3a8f
25 changed files with 414 additions and 343 deletions

View File

@@ -62,8 +62,25 @@ function enableToggles() {
evt.stopPropagation();
evt.preventDefault();
$(this).parent().parent().toggleClass('collapsed');
$(this).attr('aria-expanded', function (i, attr) {
return attr == 'true' ? 'false' : 'true'
});
highlight();
});
// navigation of nested classes using keyboard
$('#full_list a.toggle').on('keypress',function(evt) {
// enter key is pressed
if (evt.which == 13) {
evt.stopPropagation();
evt.preventDefault();
$(this).parent().parent().toggleClass('collapsed');
$(this).attr('aria-expanded', function (i, attr) {
return attr == 'true' ? 'false' : 'true'
});
highlight();
}
});
}
function populateSearchCache() {
@@ -91,7 +108,7 @@ function enableSearch() {
}
});
$('#full_list').after("<div id='noresults' style='display:none'></div>");
$('#full_list').after("<div id='noresults' role='status' style='display: none'></div>");
}
function ignoredKeyPress(event) {
@@ -154,11 +171,14 @@ function partialSearch(searchString, offset) {
function searchDone() {
searchTimeout = null;
highlight();
if ($('#full_list li:visible').size() === 0) {
$('#noresults').text('No results were found.').hide().fadeIn();
var found = $('#full_list li:visible').size();
if (found === 0) {
$('#noresults').text('No results were found.');
} else {
$('#noresults').text('').hide();
// This is read out to screen readers
$('#noresults').text('There are ' + found + ' results.');
}
$('#noresults').show();
$('#content').removeClass('insearch');
}
@@ -188,6 +208,12 @@ function expandTo(path) {
$target.addClass('clicked');
$target.removeClass('collapsed');
$target.parentsUntil('#full_list', 'li').removeClass('collapsed');
$target.find('a.toggle').attr('aria-expanded', 'true')
$target.parentsUntil('#full_list', 'li').each(function(i, el) {
$(el).find('> div > a.toggle').attr('aria-expanded', 'true');
});
if($target[0]) {
window.scrollTo(window.scrollX, $target.offset().top - 250);
highlight();