Skip to content

Commit

Permalink
fix(core): accessibility
Browse files Browse the repository at this point in the history
* fix accessibility

* fix accessibility, remove roles

* fix one page header

* update header mobile

* change header in pages

* remove pagination disabled

* update header in all pages

* fix dropdown open on small screen

* fix accessibility

* exlude mobile for screen reader

* remove tag in search modal, accessibility

* add h2 on modal search

* add h3 to modal search

* update footer aria-labels

* fix aria-label

* remove title tag, accessibility

* update aria-labels

* update aria-label

* update accessibility aria-label

* update bootstrap italia from 1.6.2 to 1.6.4

Co-authored-by: lorycade <“lorenzo.cadente@accenture.com”>
  • Loading branch information
lorycade and lorycade authored Jul 28, 2022
1 parent 685632e commit d1ec240
Show file tree
Hide file tree
Showing 34 changed files with 9,153 additions and 8,963 deletions.
5 changes: 2 additions & 3 deletions build/assets/css/bootstrap-italia.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions build/assets/css/scuole.css
Original file line number Diff line number Diff line change
Expand Up @@ -15917,7 +15917,9 @@ button.icon-text {
background-color: white;
position: absolute;
z-index: 1;
top: 50px !important;
left: 0;
transform: unset !important;
box-shadow: 0 0.25rem 0.938rem rgba(0, 0, 0, 0.15);
border-radius: 4px;
margin-top: 10px;
Expand All @@ -15927,6 +15929,11 @@ button.icon-text {
color: #455b71;
}

#sub-nav ul.nav-list .menu-dropdown-simple::before,
.sticky-main-nav ul.nav-list .menu-dropdown-simple:before {
top: -7px !important;
}

#sub-nav ul.nav-list .menu-dropdown-simple .menu-title,
.sticky-main-nav ul.nav-list .menu-dropdown-simple .menu-title {
border-bottom: 1px solid #e5e5e5;
Expand Down
5 changes: 2 additions & 3 deletions build/assets/js/bootstrap-italia.js

Large diffs are not rendered by default.

66 changes: 58 additions & 8 deletions build/assets/js/scuole.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ $(document).ready(function () {
$('#main-header').addClass('is-sticky');
$('#main-wrapper').addClass('sticked-menu');
$('body').addClass('sticked-menu-body');
$('.nav-list-secondary a').attr('tabindex', '-1');
} else {
$('#main-header').removeClass('is-sticky');
$('#main-wrapper').removeClass('sticked-menu');
$('body').removeClass('sticked-menu-body');
$('.nav-list-secondary a').removeAttr('tabindex');
}
} else {
$('#main-header').addClass('zoom');
Expand Down Expand Up @@ -111,9 +113,12 @@ $(document).ready(function () {
$(this).next(".menu-dropdown").slideUp(100);
$(this).next(".menu-dropdown").removeClass("active");
$(this).removeClass("active");
$(this).attr('aria-expanded', 'false');
} else {
$(this).parent().parent().find('.toggle-dropdown').removeClass('active');
$(this).parent().parent().find('.toggle-dropdown').attr('aria-expanded', 'false');
$(this).addClass("active");
$(this).attr('aria-expanded', 'true')
$(this).parent().parent().find('.menu-dropdown').removeClass('active');
$(this).parent().parent().find('.menu-dropdown').slideUp(100);
$(this).next(".menu-dropdown").slideDown(100);
Expand All @@ -126,6 +131,7 @@ $(document).ready(function () {
$('.menu-dropdown').slideUp(100);
$('.menu-dropdown').removeClass('active');
$('.toggle-dropdown').removeClass('active');
$('.toggle-dropdown').attr('aria-expanded', 'false')
});
$('.menu-dropdown').click(function (e) {
e.stopPropagation();
Expand Down Expand Up @@ -166,6 +172,37 @@ $(document).ready(function () {
}
});// end ready
/* End Accordion */
document.addEventListener('DOMContentLoaded', function () {
function accessibilityMobile() {
const hamburger = document.querySelector('.hamburger.toggle-menu');
const generalSearchBar = document.querySelector('.cbp-spmenu.cbp-spmenu-vertical.cbp-spmenu-left');
const focussables = generalSearchBar.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');

if (window.matchMedia('(min-width: 1200px)').matches) {
focussables.forEach(element => {
element.setAttribute('aria-hidden', 'true');
element.setAttribute('tabindex', '-1');
});
hamburger.setAttribute('aria-hidden', 'true');
hamburger.setAttribute('tabindex', '-1');
} else {
focussables.forEach(element => {
element.removeAttribute('aria-hidden');
element.removeAttribute('tabindex');
});
hamburger.removeAttribute('aria-hidden');
hamburger.removeAttribute('tabindex');
}
}

let resizeId;
window.addEventListener('resize', () => {
clearTimeout(resizeId);
resizeId = setTimeout(accessibilityMobile(), 500);
});

accessibilityMobile();
});


document.addEventListener('DOMContentLoaded', function () {
Expand Down Expand Up @@ -437,15 +474,28 @@ $(document).ready(function () {
});
/* End Simple Toggle */

$(document).ready(function () {
var skiplink = document.querySelector('.skiplink');
var mainMenu = skiplink?.querySelector('[href="#menu-principale"]');
mainMenu.addEventListener('click', () => {
var sticky = document.querySelector('.sticky-main-nav');
setTimeout(() => {
var nav = sticky.querySelector('#menu-principale a');
nav.focus();
}, 100);
});
});

/* User Logged Sticky */
$(document).ready(function () {
function header_utils_sticky() {
var window_top = $(window).scrollTop();
var div_top = $('#main-wrapper').offset().top;
var containerDsk = document.querySelector('.sticky-main-nav');
var navContainer = document.querySelector('#sub-nav .nav-container');
var mainNav = document.querySelector('#sub-nav .nav-container .main-nav');
var navListPrimaryBottom = document.querySelector('.header-bottom .dl-menu.nav-list-primary');
var navListPrimaryTop = document.querySelector('.header-top .sticky-main-nav .dl-menu.nav-list-primary');
var navListPrimaryTop = document.querySelector('.header-top .sticky-main-nav .main-nav');

var linkList = document.querySelectorAll('.sticky-main-nav a');

Expand All @@ -456,7 +506,7 @@ $(document).ready(function () {
if (window_top > div_top) {
$(".header-utils-wrapper").addClass("utils-moved");
if (!navListPrimaryTop) {
containerDsk.insertAdjacentElement('afterbegin', navListPrimaryBottom);
containerDsk.insertAdjacentElement('afterbegin', mainNav);
}
} else {
$(".header-utils-wrapper").removeClass("utils-moved");
Expand Down Expand Up @@ -506,11 +556,11 @@ $(document).ready(function () {
}

function catchFocus(linkList) {
document.addEventListener('keydown', (e) => {
var userMenu = document.querySelector('.toggle-user-menu-mobile');
var modal = document.querySelector('[data-target="#access-modal"]');
var closeMenu = document.querySelector('.hamburger.is-active');
var logo = document.querySelector('.logo-header a');
document.addEventListener('keydown', (e) => {
var userMenu = document.querySelector('.toggle-user-menu-mobile');
var modal = document.querySelector('[data-target="#access-modal"]');
var closeMenu = document.querySelector('.hamburger.is-active');
var logo = document.querySelector('.logo-header a');
if (e.which == 9 && !e.shiftKey && document.activeElement == linkList[linkList.length - 1]) {
if (userMenu) {
userMenu.focus();
Expand Down Expand Up @@ -689,7 +739,7 @@ function tabIndexUser() {
function catchFocusUser(linkList, buttonList) {
document.addEventListener('keydown', (e) => {
var notification = document.querySelector('.toggle-user-menu-mobile');
var logo = document.querySelector('.hamburger');
var logo = document.querySelector('.hamburger');
if (e.which == 9 && !e.shiftKey && document.activeElement == linkList[linkList.length - 1]) {
notification.focus();
}
Expand Down
Loading

0 comments on commit d1ec240

Please sign in to comment.