autofocus Skip Link on keyboard navigation (#13828)
* autofocus Skip Link on keyboard navigation * focus Skip Link on route change if Skip Link exists Co-authored-by: Suzanne Aitchison <suzanne@forem.com> Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
This commit is contained in:
parent
7b05bd81fe
commit
486c1890f2
2 changed files with 14 additions and 7 deletions
|
|
@ -123,6 +123,10 @@ var instantClick
|
|||
prog.classList.remove("showing");
|
||||
|
||||
if (newUrl) {
|
||||
const skipLink = document.querySelector('.skip-content-link');
|
||||
if (skipLink) {
|
||||
skipLink.focus();
|
||||
}
|
||||
history.pushState(null, null, newUrl.replace("?samepage=true","").replace("&samepage=true",""))
|
||||
|
||||
var hashIndex = newUrl.indexOf('#'),
|
||||
|
|
|
|||
|
|
@ -134,14 +134,17 @@
|
|||
height: var(--header-height);
|
||||
transform: translate(-50%, -200%);
|
||||
transition: transform var(--transition-props);
|
||||
}
|
||||
|
||||
&:focus,
|
||||
&:focus-within {
|
||||
pointer-events: auto;
|
||||
transform: translate(-50%, 0);
|
||||
outline: none;
|
||||
border: 2px solid var(--header-button-focus-color);
|
||||
}
|
||||
.js-focus-visible .skip-content-link:focus:not(.focus-visible) {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.js-focus-visible .skip-content-link:focus {
|
||||
pointer-events: auto;
|
||||
transform: translate(-50%, 0);
|
||||
outline: none;
|
||||
border: 2px solid var(--header-button-focus-color);
|
||||
}
|
||||
|
||||
.pwa-nav-buttons {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue