Revert "File dropdown is accessible through up/down keys #1284"

This reverts commit 03527bb781.
This commit is contained in:
daria 2024-02-08 15:41:35 +02:00
parent 7e85838777
commit fca3ac58ab

View File

@ -1477,57 +1477,12 @@ define([
$button.removeClass('cp-toolbar-button-active');
if ($content.is(':visible')) {
$button.addClass('cp-toolbar-button-active');
$content.find(':first').focus();
$content.focus();
var wh = $(window).height();
$content.css('max-height', Math.floor(wh - topPos - 1)+'px')
$content.children().addClass('active-element');
} else {
$content.children().removeClass('active-element');
$content.css('max-height', Math.floor(wh - topPos - 1)+'px');
}
});
var currentIndex = 0;
$(document).keydown(function(e) {
if ($content.is(':visible')) {
var activeElements = $content.find('.active-element');
switch (e.which) {
case 38: // Up
if (currentIndex > 0) {
currentIndex--;
} else {
currentIndex = activeElements.length - 1;
}
activeElements.eq(currentIndex).focus();
break;
case 40: // Down
if (currentIndex < activeElements.length - 1) {
currentIndex++;
} else {
currentIndex = 0;
}
activeElements.eq(currentIndex).focus();
break;
case 27: // Escape
$content.hide();
$content.blur();
break;
case 9: // Tab
e.preventDefault();
break;
default:
return;
}
e.preventDefault();
}
});
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.attributeName === "style") {