1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Improve SEO & accessibility on mode toggle element

This commit is contained in:
Cotes Chung
2021-12-07 18:17:20 +08:00
parent 415f11ecb8
commit c64e587335
8 changed files with 36 additions and 17 deletions

View File

@@ -1,10 +1,13 @@
/*
* Document-reday functions for '#mode-toggle-wrapper'
* Listener for theme mode toggle
*/
$(function() {
$("#mode-toggle-wrapper").keyup((e) => {
if(e.keyCode === 13) {
flipMode();
}
$(".mode-toggle").click((e) => {
const $target = $(e.target);
let $btn = ($target.prop("tagName") === "button".toUpperCase() ?
$target : $target.parent());
$btn.blur(); // remove the clicking outline
flipMode();
});
});