| 1 |
(function () { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
/** |
| 5 |
* Blockenberg Google Map — frontend script |
| 6 |
* |
| 7 |
* Minimal enhancement: |
| 8 |
* - Ensures every iframe has a title for accessibility (in case a theme strips it). |
| 9 |
* - Adds keyboard focusability to the iframe so keyboard users can interact. |
| 10 |
*/ |
| 11 |
function initMaps() { |
| 12 |
var maps = document.querySelectorAll('.bkbg-gm-wrap iframe'); |
| 13 |
if (!maps.length) return; |
| 14 |
|
| 15 |
maps.forEach(function (iframe) { |
| 16 |
// Ensure title attribute exists (accessibility/screen-readers) |
| 17 |
if (!iframe.getAttribute('title')) { |
| 18 |
iframe.setAttribute('title', 'Google Map'); |
| 19 |
} |
| 20 |
|
| 21 |
// Make iframe keyboard-focusable if it isn't already |
| 22 |
if (!iframe.hasAttribute('tabindex')) { |
| 23 |
iframe.setAttribute('tabindex', '0'); |
| 24 |
} |
| 25 |
}); |
| 26 |
} |
| 27 |
|
| 28 |
if (document.readyState === 'loading') { |
| 29 |
document.addEventListener('DOMContentLoaded', initMaps); |
| 30 |
} else { |
| 31 |
initMaps(); |
| 32 |
} |
| 33 |
})(); |
| 34 |
|