[BUGFIX] resolve firefox issue aria-pressed state

This commit is contained in:
Marie Birner 2023-04-10 15:04:13 +02:00
parent 504192e5f2
commit 030158a3eb

View File

@ -13,6 +13,7 @@ function initToggle() {
if(toggle) { if(toggle) {
toggle.addEventListener('click', () => { toggle.addEventListener('click', () => {
toggle.ariaPressed = (toggle.ariaPressed === 'true') ? 'false' : 'true'; toggle.ariaPressed = (toggle.ariaPressed === 'true') ? 'false' : 'true';
toggle.setAttribute('aria-pressed', toggle.ariaPressed);
const daysNoTrips = document.querySelectorAll('div[data-trips="0"]'); const daysNoTrips = document.querySelectorAll('div[data-trips="0"]');
Array.prototype.forEach.call(daysNoTrips, (day: HTMLElement) => { Array.prototype.forEach.call(daysNoTrips, (day: HTMLElement) => {
@ -26,6 +27,7 @@ function initToggle() {
if(coxToggle) { if(coxToggle) {
coxToggle.addEventListener('click', () => { coxToggle.addEventListener('click', () => {
coxToggle.ariaPressed = (coxToggle.ariaPressed === 'true') ? 'false' : 'true'; coxToggle.ariaPressed = (coxToggle.ariaPressed === 'true') ? 'false' : 'true';
coxToggle.setAttribute('aria-pressed', coxToggle.ariaPressed);
const noCoxNeeded = document.querySelectorAll('div[data-coxneeded="false"]'); const noCoxNeeded = document.querySelectorAll('div[data-coxneeded="false"]');
Array.prototype.forEach.call(noCoxNeeded, (notNeeded: HTMLElement) => { Array.prototype.forEach.call(noCoxNeeded, (notNeeded: HTMLElement) => {
@ -40,6 +42,7 @@ function initToggle() {
if(monthToggle) { if(monthToggle) {
monthToggle.addEventListener('click', () => { monthToggle.addEventListener('click', () => {
monthToggle.ariaPressed = (monthToggle.ariaPressed === 'true') ? 'false' : 'true'; monthToggle.ariaPressed = (monthToggle.ariaPressed === 'true') ? 'false' : 'true';
monthToggle.setAttribute('aria-pressed', monthToggle.ariaPressed);
const currentMonth = monthToggle.dataset.month; const currentMonth = monthToggle.dataset.month;
if(currentMonth) { if(currentMonth) {