mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
Revert "File dropdown is accessible through up/down keys #1284"
This reverts commit 03527bb781.
This commit is contained in:
parent
7e85838777
commit
fca3ac58ab
@ -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") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user