Skip to content
Snippets Groups Projects
Commit b463232f authored by Moritz Strohm's avatar Moritz Strohm Committed by Jan-Hendrik Willms
Browse files

made table of content in wiki accessible via keyboard enter key

parent 4e725622
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() { ...@@ -227,3 +227,12 @@ $(document).on('change', 'input[data-must-equal]', function() {
this.setCustomValidity(''); 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 @@ ...@@ -16,7 +16,7 @@
<div class="contentbar-icons"> <div class="contentbar-icons">
<? if ($toc->hasChildren()) : ?> <? if ($toc->hasChildren()) : ?>
<input type="checkbox" id="cb-toc"> <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) ?> <?= Icon::create('table-of-contents')->asImg(24) ?>
</label> </label>
<?= $ttpl->render() ?> <?= $ttpl->render() ?>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<article class="toc_overview toc_transform" id="toc"> <article class="toc_overview toc_transform" id="toc">
<header id="toc_header"> <header id="toc_header">
<h1 id="toc_h1"><?= sprintf(_('Inhalt (%u Elemente)'), htmlReady($root->countAllChildren())) ?></h1> <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) ?> <?= Icon::create('decline')->asImg(24) ?>
</label> </label>
</header> </header>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment