diff --git a/frontend/main.ts b/frontend/main.ts index c7c48cd..1e1d7cb 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -21,7 +21,7 @@ function initToggle() { if(filter) { let filterMap = new Map(JSON.parse(filter)); for (let entry of filterMap.entries()) { - if(entry[0] === btn.dataset.action) { + if(entry[0] === btn.dataset.action && entry[1] !== 'true') { filterMap.set(entry[0],'true'); } else { filterMap.set(entry[0],'false'); @@ -30,12 +30,13 @@ function initToggle() { sessionStorage.setItem('tripsFilter', JSON.stringify( Array.from(filterMap.entries()))); } resetFilteredElements(); - console.log(btn.ariaPressed); if(btn.ariaPressed === 'false'){ Array.prototype.forEach.call(btns, (b: HTMLButtonElement) => { b.setAttribute('aria-pressed', 'false'); }); triggerFilterAction(btn.dataset.action); + } else { + btn.setAttribute('aria-pressed', 'false'); } }); });