aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-01-13 19:51:49 +0100
committerGuilhem Moulin <guilhem@fripost.org>2024-01-13 23:49:45 +0100
commite6acb7eef6c243c6dbabd90bc235480f3b44324d (patch)
tree1851c02e18f852578ba2b803f1f628929592d9bd
parentb0d7609c9e386ecdc383f73d59f94f94097b33f1 (diff)
Replace .ariaExpanded/.ariaHidden with .setAttribute().
The former appears not to work well with Firefox (the attribute is updated internally but the source doesn't change and the element remains unvisible).
-rw-r--r--main.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/main.js b/main.js
index d59adbf..d542434 100644
--- a/main.js
+++ b/main.js
@@ -175,7 +175,7 @@ const menu = document.getElementById('map-menu');
const btn = document.createElement('button');
div.appendChild(btn);
btn.type = 'button';
- btn.ariaExpanded = 'false';
+ btn.setAttribute('aria-expanded', 'false');
btn.title = 'Byt kartlager';
btn.classList.add('btn', 'btn-light');
@@ -185,14 +185,14 @@ const menu = document.getElementById('map-menu');
const panel = document.getElementById('layer-selection-panel');
btn.onclick = function(event) {
- if (btn.ariaExpanded === 'true') {
- panel.ariaHidden = 'true';
- btn.ariaExpanded = 'false';
+ if (btn.getAttribute('aria-expanded') === 'true') {
+ panel.setAttribute('aria-hidden', 'true');
+ btn.setAttribute('aria-expanded', 'false');
btn.classList.add('btn-light');
btn.classList.remove('btn-dark');
} else {
- panel.ariaHidden = 'false';
- btn.ariaExpanded = 'true';
+ panel.setAttribute('aria-hidden', 'false');
+ btn.setAttribute('aria-expanded', 'true');
btn.classList.add('btn-dark');
btn.classList.remove('btn-light');
}
@@ -246,7 +246,7 @@ const menu = document.getElementById('map-menu');
const btn = document.createElement('button');
div.appendChild(btn);
btn.type = 'button';
- btn.ariaExpanded = 'false';
+ btn.setAttribute('aria-expanded', 'false');
btn.title = 'Visa information';
btn.classList.add('btn', 'btn-light');
@@ -257,12 +257,12 @@ const menu = document.getElementById('map-menu');
const panel = document.getElementById('modal-info');
const modal = new Modal(panel, {});
panel.addEventListener('show.bs.modal', function() {
- btn.ariaExpanded = 'true';
+ btn.setAttribute('aria-expanded', 'true');
btn.classList.add('btn-dark');
btn.classList.remove('btn-light');
});
panel.addEventListener('hidden.bs.modal', function() {
- btn.ariaExpanded = 'false';
+ btn.setAttribute('aria-expanded', 'false');
btn.classList.add('btn-light');
btn.classList.remove('btn-dark');
});
@@ -273,7 +273,7 @@ const menu = document.getElementById('map-menu');
})();
/* we're all set, show the control container now */
-container.ariaHidden = 'false';
+container.setAttribute('aria-hidden', 'false');
document.getElementById('layer-topowebb_nedtonad').onchange = function(event) {
const layer = event.target.checked ? 'topowebb_nedtonad' : 'topowebb';