-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make "Missing Mapbox GL JS CSS" a console warning #5786
Comments
For now the workaround I'm using is adding |
Just encountered another confused user. (He told me that "the CSS isn't loading", on the strength of that DOM element.) Another possible solution would be deleting the DOM element once the CSS has indeed loaded. |
FWIW, the CSSOM APIs only function as expected with cross-loaded CSS resources when the attribute If you load the CSS as most people do, with In the absence of a better solution, simply checking the computed style of let mapboxglMap = document.querySelector('.mapboxgl-map')
if (!mapboxglMap || window.getComputedStyle(mapboxglMap).overflow != 'hidden') {
// CSS error
} The nasty bit is that it depends on a hardcoded CSS value that could change in the future. Thoughts as to whether this might be an appropriate method of checking if the CSS has loaded? |
Putting "Missing Mapbox GL JS CSS" in the DOM has confused at least one user (#5785) and causes other issues (#5359 (comment)).
Instead, it should be a console warning that's logged when a map is created and there's no CSS rule targeting
.mapboxgl-map
present. This can be checked using CSSOM APIs.The text was updated successfully, but these errors were encountered: