Added focus style and menu keyboard toggle
This commit is contained in:
parent
91a1111182
commit
81029205cc
@ -6,7 +6,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<input type="checkbox" id="nav-toggle" checked />
|
<input type="checkbox" id="nav-toggle" checked />
|
||||||
<label for="nav-toggle" id="nav-toggle-label" class="fas fa-bars fa-lg">
|
<label for="nav-toggle" id="nav-toggle-label" tabindex="0" class="fas fa-bars fa-lg">
|
||||||
<span hidden>Menu Button</span>
|
<span hidden>Menu Button</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
@ -213,6 +213,21 @@ div.alert.alert-success a {
|
|||||||
content: "\f185";
|
content: "\f185";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*:focus:not(.dropdown-item) {
|
||||||
|
outline: 2px solid yellow;
|
||||||
|
outline-offset: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus {
|
||||||
|
outline: 2px solid yellow !important;
|
||||||
|
outline-offset: 0.1em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.alert.alert-warning a {
|
||||||
|
outline: 2px solid #000289 !important;
|
||||||
|
outline-offset: 0.1em !important;
|
||||||
|
}
|
||||||
|
|
||||||
.twitter { background: desaturate($twitter, 25%); }
|
.twitter { background: desaturate($twitter, 25%); }
|
||||||
.mastodon { background: desaturate($mastodon, 25%); }
|
.mastodon { background: desaturate($mastodon, 25%); }
|
||||||
.facebook { background: desaturate($facebook, 25%); }
|
.facebook { background: desaturate($facebook, 25%); }
|
||||||
|
@ -479,3 +479,30 @@ input#nav-toggle,
|
|||||||
[data-toggle="tooltip"]:hover:after {
|
[data-toggle="tooltip"]:hover:after {
|
||||||
opacity: .9;
|
opacity: .9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Focus style
|
||||||
|
|
||||||
|
nav *:focus:not(.dropdown-item) {
|
||||||
|
outline: 2px solid yellow;
|
||||||
|
outline-offset: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer div > a:focus {
|
||||||
|
outline: 4px solid #0100ff !important;
|
||||||
|
z-index: 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
*:focus:not(.dropdown-item) {
|
||||||
|
outline: 2px solid #0100ff;
|
||||||
|
outline-offset: 0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:focus {
|
||||||
|
outline: 2px solid #0100ff !important;
|
||||||
|
outline-offset: 0.1em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.alert.alert-warning a {
|
||||||
|
outline: 2px solid #0100ff !important;
|
||||||
|
outline-offset: 0.1em !important;
|
||||||
|
}
|
@ -36,7 +36,18 @@ function navSectionsClose(event) {
|
|||||||
// Dark/Light color scheme switch button
|
// Dark/Light color scheme switch button
|
||||||
document.querySelector("#nav-switch-theme").style.display = "inline";
|
document.querySelector("#nav-switch-theme").style.display = "inline";
|
||||||
document.querySelector("#nav-switch-theme").addEventListener("click", changeColorScheme);
|
document.querySelector("#nav-switch-theme").addEventListener("click", changeColorScheme);
|
||||||
document.querySelector("#nav-switch-theme").addEventListener("keydown", handleBtnKeyDown);
|
document.querySelector("#nav-switch-theme").addEventListener("keydown", e => {
|
||||||
|
if (e.key === " " || e.key === "Enter" || e.key === "Spacebar") {
|
||||||
|
e.preventDefault();
|
||||||
|
changeColorScheme();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.querySelector("#nav-toggle-label").addEventListener("keydown", e => {
|
||||||
|
if (e.key === " " || e.key === "Enter" || e.key === "Spacebar") {
|
||||||
|
e.preventDefault();
|
||||||
|
document.getElementById('nav-toggle').checked = !document.getElementById('nav-toggle').checked;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function changeColorScheme() {
|
function changeColorScheme() {
|
||||||
// Use whatever users want
|
// Use whatever users want
|
||||||
@ -91,13 +102,4 @@ if (
|
|||||||
localStorage.getItem("colorScheme") === "light")
|
localStorage.getItem("colorScheme") === "light")
|
||||||
) {
|
) {
|
||||||
fixThemeImages();
|
fixThemeImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleBtnKeyDown(event) {
|
|
||||||
// Check to see if space or enter were pressed
|
|
||||||
if (event.key === " " || event.key === "Enter" || event.key === "Spacebar") { // "Spacebar" for IE11 support
|
|
||||||
// Prevent the default action to stop scrolling when space is pressed
|
|
||||||
event.preventDefault();
|
|
||||||
changeColorScheme();
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user