Simple question: what selector is needed to access the Geolocate Control in Mapbox GL JS?
You can easily get access to all the various map controls to add attributes such as title tags, accessibility tags (aria-label, etc) and even to enable bootstrap tooltips and data-toggles and so forth.
However,I have not been able to get access to the Geolocate Control, either through straight javascript or jquery, despite using a wide variety of attempted selectors. It simply doesn't respond to anything that I've tried.
Below is a jsfiddle showing the situation. This is the simple case of adding title attributes. I show it successfully on the navigation controls, then unsuccessfully on the geolocate control.
Is this just some obvious selector error, or is there something fundamentally different about the geolocate control that I'm missing? Or is this a bug? https://jsfiddle.net/5413yjmr/
Works:
document.querySelector('.mapboxgl-ctrl-compass').setAttribute('title', 'Compass Control');
Doesn't Work:
document.querySelector('.mapboxgl-ctrl-geolocate').setAttribute('title', 'Find My Current Location');
Also doesn't work:
document.querySelector('.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate').setAttribute('title', 'Find My Current Location');
I've also gone fairly crazy trying all kinds of different selectors, using jquery to get to them, etc.