Skip to content
Snippets Groups Projects
Commit 8d2c6f5a authored by Thomas Hackl's avatar Thomas Hackl
Browse files

Resolve "Barrierefreiheit: "Back to top" ist nicht per Tabulator erreichbar"

Closes #3941

Merge request studip/studip!2800
parent cd724f84
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,9 @@ let fold;
let was_below_the_fold = false;
const back_to_top = function(scrolltop) {
var is_below_the_fold = scrolltop > fold;
let is_below_the_fold = scrolltop > fold;
if (is_below_the_fold !== was_below_the_fold) {
$('#scroll-to-top').toggleClass('hide', !is_below_the_fold);
document.getElementById('scroll-to-top').classList.toggle('hide', !is_below_the_fold);
was_below_the_fold = is_below_the_fold;
}
};
......@@ -23,15 +23,21 @@ const ScrollToTop = {
},
disable() {
Scroll.removeHandler('header');
$('#scroll-to-top').addClass('hide');
document.getElementById('scroll-to-top').classList.add('hide');
},
moveBack() {
$('#scroll-to-top').on('click', function(e) {
$('html, body').stop().animate({
scrollTop: (0)
}, 1000, 'easeInOutExpo');
e.preventDefault();
document.getElementById('scroll-to-top').addEventListener('click', (evt) => {
evt.preventDefault();
this.toTop();
});
document.getElementById('scroll-to-top').addEventListener('keypress', (evt) => {
if (evt.code === 'Space') {
this.toTop();
}
});
},
toTop() {
window.scroll({top: 0, left: 0, behavior: 'smooth'});
}
};
......
......@@ -96,7 +96,7 @@ $lang_attr = str_replace('_', '-', $_SESSION['_language']);
</main>
<!-- End main content -->
<a id="scroll-to-top" class="hide">
<a id="scroll-to-top" class="hide" tabindex="0" title="<?= _('Zurück zum Seitenanfang') ?>">
<?= Icon::create('arr_1up', 'info_alt')->asImg(24, ['class' => '']) ?>
</a>
......
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