Fix details sneak-peek keyup

This commit is contained in:
Richard Schreiber
2023-09-08 13:15:19 +02:00
parent 1478f191a8
commit b04ec720dc

View File

@@ -67,13 +67,14 @@ setup_collapsible_details = function (el) {
e.preventDefault();
return false;
}).keyup(function (event) {
if ($details.hasClass('sneak-peek')) {
// if sneak-peek is active, needs to be handled differently
return true;
}
if (32 == event.keyCode || (13 == event.keyCode && !isOpera)) {
// Space or Enter is pressed — trigger the `click` event on the `summary` element
// Opera already seems to trigger the `click` event when Enter is pressed
var $details = $(this).closest("details");
if ($details.hasClass('sneak-peek')) {
// if sneak-peek is active, needs to be handled differently
return true;
}
event.preventDefault();
$(this).click();
}