Skip to content

Vendor a glyphicons-only stylesheet instead of the full Bootstrap 3 base - #2257

Open
adarshsm wants to merge 1 commit into
python-visualization:mainfrom
adarshsm:fix/1820-vendored-glyphicons
Open

Vendor a glyphicons-only stylesheet instead of the full Bootstrap 3 base#2257
adarshsm wants to merge 1 commit into
python-visualization:mainfrom
adarshsm:fix/1820-vendored-glyphicons

Conversation

@adarshsm

Copy link
Copy Markdown

Closes #1820. Thanks @hansthen for the steer.

folium loads netdna's bootstrap-glyphicons.css for the Awesome Markers glyphicon font. Despite the name, that file is a full Bootstrap 3 base stylesheet — alongside the @font-face/.glyphicon rules it ships a normalize reset and global body rules (font, colour, background, margin). Loaded after Bootstrap 5, those body rules leak onto the host page and, for example, mis-position a user-added Bootstrap 5 modal (the original report).

This vendors folium/templates/glyphicons.css containing only the @font-face and .glyphicon/.glyphicon-* rules (fonts served from jsDelivr), referenced the same way as the existing leaflet.awesome.rotate.css. Icon(prefix="glyphicon") markers keep working exactly as before; the page-wide body/reset pollution is gone.

Not a customer-facing change — glyphicon markers are unaffected; the only difference is that folium stops overriding the host page's body styles. Added a regression test asserting the vendored file is used and the netdna URL is gone.

folium loaded netdna's bootstrap-glyphicons.css for the Awesome Markers
glyphicon font. Despite its name that file is a full Bootstrap 3 base
stylesheet: alongside the @font-face/.glyphicon rules it ships a normalize
reset and global body styles (font, colour, background, margin). Loaded
after Bootstrap 5, those body rules leaked onto the host page and, e.g.,
mispositioned user-added Bootstrap 5 components (python-visualizationGH-1820).

Ship a vendored folium/templates/glyphicons.css with only the @font-face
and .glyphicon/.glyphicon-* rules (fonts served from jsDelivr), referenced
the same way as leaflet.awesome.rotate.css. Icon(prefix="glyphicon")
markers keep working; the page-wide body/reset pollution is gone.

Closes python-visualization#1820
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default CSS for glyphicons produces conflict with bootstrap5 components (with potential solution)

1 participant