MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 10: | Line 10: | ||
function disableMapFocus() { | function disableMapFocus() { | ||
var maps = document.querySelectorAll('.leaflet | var maps = document.querySelectorAll('.maps-leaflet'); | ||
maps.forEach(function(map) { | maps.forEach(function(map) { | ||
map.setAttribute('tabindex', '-1'); | map.setAttribute('tabindex', '-1'); | ||
Revision as of 19:29, 14 January 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/**
* Prevent Leaflet maps from auto-scrolling page on load
* by removing focusability from the map container
*/
(function() {
'use strict';
function disableMapFocus() {
var maps = document.querySelectorAll('.maps-leaflet');
maps.forEach(function(map) {
map.setAttribute('tabindex', '-1');
});
}
// Run immediately and again after a delay (maps initialize asynchronously)
disableMapFocus();
setTimeout(disableMapFocus, 500);
})();