improve browser compatability
in some browsers ariaPressed is only supported since 2023. We use a data attribute as a fallback
This commit is contained in:
parent
14a514e3e4
commit
caa96f565f
5 changed files with 42 additions and 17 deletions
10
elevators.js
10
elevators.js
|
@ -640,10 +640,10 @@ function filterData() {
|
|||
const typeA = document.querySelector('button.typeChip[data-type="A"]');
|
||||
const typeR = document.querySelector('button.typeChip[data-type="R"]');
|
||||
const activeTypes = [];
|
||||
if(typeU.ariaPressed === 'true') activeTypes.push('U');
|
||||
if(typeS.ariaPressed === 'true') activeTypes.push('S');
|
||||
if(typeA.ariaPressed === 'true') activeTypes.push('A');
|
||||
if(typeR.ariaPressed === 'true') activeTypes.push('R');
|
||||
if(typeU.dataset.pressed === 'true') activeTypes.push('U');
|
||||
if(typeS.dataset.pressed === 'true') activeTypes.push('S');
|
||||
if(typeA.dataset.pressed === 'true') activeTypes.push('A');
|
||||
if(typeR.dataset.pressed === 'true') activeTypes.push('R');
|
||||
if (internalData) {
|
||||
for (const stationIndex in internalData.stations) {
|
||||
const matchesSearch = internalData.stations[stationIndex].name.toLowerCase().search(searchString.toLowerCase()) >= 0;
|
||||
|
@ -662,7 +662,7 @@ document.querySelector('#searchStation').addEventListener('input', (e) => {
|
|||
|
||||
document.querySelectorAll('button.typeChip').forEach(e => {
|
||||
e.addEventListener('click', (event) => {
|
||||
e.ariaPressed = e.ariaPressed === 'true' ? 'false' : 'true';
|
||||
e.ariaPressed = e.dataset.pressed = e.dataset.pressed === 'true' ? 'false' : 'true';
|
||||
filterData();
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue