Adding accesibility fixes.
This commit is contained in:
parent
f94663fddf
commit
f5436d6818
@ -5,26 +5,41 @@ require('tablesort/src/sorts/tablesort.number');
|
|||||||
|
|
||||||
let fakeSearchInput
|
let fakeSearchInput
|
||||||
let searchMobile
|
let searchMobile
|
||||||
window.onload = () => {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const menu_expand = document.querySelector('a.menu-expand');
|
const menu_expand = document.querySelector('a.menu-expand');
|
||||||
const mobile_foldable = document.querySelector('nav.mobile-foldable');
|
const mobile_foldable = document.querySelector('nav.mobile-foldable');
|
||||||
const transparentFullscreenHide = document.querySelector('div.transparent-fullscreen-hide');
|
const transparentFullscreenHide = document.querySelector('div.transparent-fullscreen-hide');
|
||||||
|
const contentsWithoutMenu = document.querySelector('div.contents-without-menu')
|
||||||
const tables = document.querySelectorAll('table')
|
const tables = document.querySelectorAll('table')
|
||||||
|
|
||||||
fillFarmaciaGuardia();
|
fillFarmaciaGuardia();
|
||||||
loadAd()
|
loadAd()
|
||||||
addEasterEggAnimation()
|
addEasterEggAnimation()
|
||||||
|
|
||||||
if (menu_expand !== null && mobile_foldable !== null && transparentFullscreenHide !== null) {
|
if (menu_expand !== null && mobile_foldable !== null && transparentFullscreenHide !== null && contentsWithoutMenu !== null) {
|
||||||
|
mobile_foldable.toggleAttribute('aria-hidden')
|
||||||
|
if (mobile_foldable.getAttribute('aria-hidden') !== null) {
|
||||||
|
mobile_foldable.setAttribute('aria-hidden', true);
|
||||||
|
}
|
||||||
transparentFullscreenHide.addEventListener('click', () => {
|
transparentFullscreenHide.addEventListener('click', () => {
|
||||||
mobile_foldable.classList.remove('show');
|
mobile_foldable.classList.remove('show');
|
||||||
transparentFullscreenHide.classList.remove('show');
|
transparentFullscreenHide.classList.remove('show');
|
||||||
menu_expand.classList.remove('active');
|
menu_expand.classList.remove('active');
|
||||||
|
contentsWithoutMenu.removeAttribute('aria-hidden')
|
||||||
|
mobile_foldable.setAttribute('aria-hidden', true)
|
||||||
});
|
});
|
||||||
menu_expand.addEventListener('click', () => {
|
menu_expand.addEventListener('click', () => {
|
||||||
menu_expand.classList.toggle('active');
|
menu_expand.classList.toggle('active');
|
||||||
mobile_foldable.classList.toggle('show');
|
mobile_foldable.classList.toggle('show');
|
||||||
transparentFullscreenHide.classList.toggle('show');
|
transparentFullscreenHide.classList.toggle('show');
|
||||||
|
contentsWithoutMenu.toggleAttribute('aria-hidden')
|
||||||
|
if (contentsWithoutMenu.getAttribute('aria-hidden') !== null) {
|
||||||
|
contentsWithoutMenu.setAttribute('aria-hidden', true);
|
||||||
|
}
|
||||||
|
mobile_foldable.toggleAttribute('aria-hidden')
|
||||||
|
if (mobile_foldable.getAttribute('aria-hidden') !== null) {
|
||||||
|
mobile_foldable.setAttribute('aria-hidden', true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +61,7 @@ window.onload = () => {
|
|||||||
searchMobile = document.querySelector('nav.mobile-shortcuts div.search')
|
searchMobile = document.querySelector('nav.mobile-shortcuts div.search')
|
||||||
fakeSearchInput = searchMobile.querySelector('input')
|
fakeSearchInput = searchMobile.querySelector('input')
|
||||||
addListenersSearch()
|
addListenersSearch()
|
||||||
};
|
}, false);
|
||||||
|
|
||||||
function fillFarmaciaGuardia() {
|
function fillFarmaciaGuardia() {
|
||||||
const farmaciaName = document.querySelector('#farmacia-name');
|
const farmaciaName = document.querySelector('#farmacia-name');
|
||||||
|
@ -200,13 +200,14 @@ body {
|
|||||||
body div.transparent-fullscreen-hide.show {
|
body div.transparent-fullscreen-hide.show {
|
||||||
display: block; }
|
display: block; }
|
||||||
body nav.mobile-foldable {
|
body nav.mobile-foldable {
|
||||||
|
visibility: hidden;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
top: 60px;
|
top: 60px;
|
||||||
height: calc(100% - 60px);
|
height: calc(100% - 60px);
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
transition: left 0.5s ease-in;
|
transition: left 0.5s ease-in, visibility 0.5s ease-in;
|
||||||
background: white; }
|
background: white; }
|
||||||
body nav.mobile-foldable > a:first-child {
|
body nav.mobile-foldable > a:first-child {
|
||||||
margin-top: 30px; }
|
margin-top: 30px; }
|
||||||
@ -230,7 +231,8 @@ body {
|
|||||||
display: list-item;
|
display: list-item;
|
||||||
font-size: 1em; }
|
font-size: 1em; }
|
||||||
body nav.mobile-foldable.show {
|
body nav.mobile-foldable.show {
|
||||||
left: 30%; }
|
left: 30%;
|
||||||
|
visibility: visible; }
|
||||||
body nav.mobile-shortcuts > a {
|
body nav.mobile-shortcuts > a {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -238,6 +240,8 @@ body {
|
|||||||
body nav.mobile-shortcuts > a.active {
|
body nav.mobile-shortcuts > a.active {
|
||||||
background: white;
|
background: white;
|
||||||
color: #dcdcf5; }
|
color: #dcdcf5; }
|
||||||
|
body nav.mobile-shortcuts > a.active:focus {
|
||||||
|
background: #f2eb8c; }
|
||||||
body a.menu-expand {
|
body a.menu-expand {
|
||||||
padding-bottom: 9px; }
|
padding-bottom: 9px; }
|
||||||
body a.menu-expand .open-menu-icon-hover {
|
body a.menu-expand .open-menu-icon-hover {
|
||||||
|
@ -296,13 +296,14 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nav.mobile-foldable {
|
nav.mobile-foldable {
|
||||||
|
visibility: hidden;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
width: 70%;
|
width: 70%;
|
||||||
top: 60px;
|
top: 60px;
|
||||||
height: calc(100% - 60px);
|
height: calc(100% - 60px);
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
transition: left 0.5s ease-in;
|
transition: left 0.5s ease-in, visibility 0.5s ease-in;
|
||||||
background: $background_sidebar;
|
background: $background_sidebar;
|
||||||
|
|
||||||
& > a:first-child {
|
& > a:first-child {
|
||||||
@ -339,6 +340,7 @@ body {
|
|||||||
|
|
||||||
nav.mobile-foldable.show {
|
nav.mobile-foldable.show {
|
||||||
left: 30%;
|
left: 30%;
|
||||||
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.mobile-shortcuts > a {
|
nav.mobile-shortcuts > a {
|
||||||
@ -348,6 +350,9 @@ body {
|
|||||||
&.active {
|
&.active {
|
||||||
background: $background_sidebar;
|
background: $background_sidebar;
|
||||||
color: $color_sidebar;
|
color: $color_sidebar;
|
||||||
|
&:focus {
|
||||||
|
background: $color_div;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -58,6 +58,7 @@
|
|||||||
<div class="complete-container">
|
<div class="complete-container">
|
||||||
%= include 'page/_mobile_menu', categories => $categories
|
%= include 'page/_mobile_menu', categories => $categories
|
||||||
%= include 'page/_mobile_foldable', categories => $categories
|
%= include 'page/_mobile_foldable', categories => $categories
|
||||||
|
<div class="contents-without-menu">
|
||||||
<div class="search-in-page">
|
<div class="search-in-page">
|
||||||
<a href="#" class="down">
|
<a href="#" class="down">
|
||||||
<img alt="Next result" src="/img/down.svg"/>
|
<img alt="Next result" src="/img/down.svg"/>
|
||||||
@ -97,4 +98,5 @@
|
|||||||
</div>
|
</div>
|
||||||
%= include 'ads/_carousel'
|
%= include 'ads/_carousel'
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</html>
|
</html>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<nav class="mobile-shortcuts">
|
<nav class="mobile-shortcuts">
|
||||||
<a class="go-to-index" href="<%='/'.$categories->{index}{slug}%>"><%== $categories->{index}{menu_text} %></a>
|
<a class="go-to-index" href="<%='/'.$categories->{index}{slug}%>"><%== $categories->{index}{menu_text} %></a>
|
||||||
%= include 'page/_search_bar'
|
%= include 'page/_search_bar'
|
||||||
<a class="menu-expand">
|
<a class="menu-expand" href="#">
|
||||||
<img class="open-menu-icon" src="/img/hamburger-menu-yellow.webp" alt="Expandir el menú."/>
|
<img class="open-menu-icon" src="/img/hamburger-menu-yellow.webp" alt="Expandir el menú."/>
|
||||||
<img class="open-menu-icon-hover" src="/img/hamburger-menu-purple.webp" alt="Expandir el menú."/>
|
<img class="open-menu-icon-hover" src="/img/hamburger-menu-purple.webp" alt="Expandir el menú."/>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user