diff options
author | Cassidy Dingenskirchen <admin@15318.de> | 2023-10-22 19:05:28 +0200 |
---|---|---|
committer | Cassidy Dingenskirchen <admin@15318.de> | 2023-10-22 19:05:28 +0200 |
commit | f1bb21cc7a0bcb799e9902a4a268ddf78d1d3f55 (patch) | |
tree | 88d32cabd944f8e150005b9c696f9853a1c16dc7 /public/static/js | |
parent | 326c23084c23d1e098d33cf4306b2e68874d0d7c (diff) |
departure board: better keyboard accessibility
Diffstat (limited to 'public/static/js')
-rw-r--r-- | public/static/js/travelynx-actions.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/public/static/js/travelynx-actions.js b/public/static/js/travelynx-actions.js index 1b6dd8a..52ca482 100644 --- a/public/static/js/travelynx-actions.js +++ b/public/static/js/travelynx-actions.js @@ -298,9 +298,19 @@ $(document).ready(function() { $('a[href]').click(function() { $('nav .preloader-wrapper').addClass('active'); }); + $('a[href="#now"]').keydown(function(event) { + // also trigger click handler on keyboard enter + if (event.keyCode == 13) { + event.preventDefault(); + event.target.click(); + } + }); $('a[href="#now"]').click(function(event) { event.preventDefault(); - $('#now')[0].scrollIntoView({behavior: "smooth", block: "center"}); + $('nav .preloader-wrapper').removeClass('active'); + now_el = $('#now')[0]; + now_el.previousElementSibling.querySelector(".dep-time").focus(); + now_el.scrollIntoView({behavior: "smooth", block: "center"}); }); const elems = document.querySelectorAll('.carousel'); const instances = M.Carousel.init(elems, { |