Skip to content
Snippets Groups Projects
Commit 57484a83 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

made table of content in wiki accessible via keyboard enter key

parent 3b5a8591
No related branches found
No related tags found
No related merge requests found
......@@ -227,3 +227,12 @@ $(document).on('change', 'input[data-must-equal]', function() {
this.setCustomValidity('');
}
});
//Generalisation: The enter-accessible class allows an element to be accessible via keyboard
//by triggering the click event when the enter key is pressed.
$(document).on('keydown', '.enter-accessible', function(event) {
if (event.code == 'Enter') {
//The enter key has been pressed.
$(this).trigger('click');
}
});
......@@ -16,7 +16,7 @@
<div class="contentbar-icons">
<? if ($toc->hasChildren()) : ?>
<input type="checkbox" id="cb-toc">
<label for="cb-toc" class="check-box" title="<?= _('Inhaltsverzeichnis') ?>" >
<label for="cb-toc" class="check-box enter-accessible" title="<?= _('Inhaltsverzeichnis') ?>" tabindex="0">
<?= Icon::create('table-of-contents')->asImg(24) ?>
</label>
<?= $ttpl->render() ?>
......
......@@ -2,7 +2,7 @@
<article class="toc_overview toc_transform" id="toc">
<header id="toc_header">
<h1 id="toc_h1"><?= sprintf(_('Inhalt (%u Elemente)'), htmlReady($root->countAllChildren())) ?></h1>
<label for="cb-toc" class="check-box" title="<?= _('Schließen')?>">
<label for="cb-toc" class="check-box enter-accessible" title="<?= _('Schließen')?>" tabindex="0">
<?= Icon::create('decline')->asImg(24) ?>
</label>
</header>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment