Skip to content

Fix broken styling of map attributions #7526

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emilykl
Copy link
Contributor

@emilykl emilykl commented Aug 18, 2025

Closes https://github.com/plotly/plotly-studio/issues/1175

Map attributions were styled incorrectly for plots using MapLibre (scattermap, densitymap, scattermap traces).

This was because a MapLibre stylesheet was missing due to being incorrectly handled in the bundling process.

The bug was introduced by the migration to esbuild (#6909) and present as of Plotly.js 3.0.0.

This PR fixes that issue by using a different tool to inline the missing CSS directly into the JS bundle.

Before fix:
Screenshot 2025-08-18 at 12 39 25 PM

After fix:
Screenshot 2025-08-18 at 12 39 09 PM


This commit demonstrates the resulting difference in the dist/plotly.js file (not included in this PR since we only update dist/ during the release process).


As an aside, this was not caught by the image tests because the Plotly.toImage() function for MapLibre plots calls map.getCanvas() which does not include the attribution, so Plotly.js manually adds the attribution to the generated image.

@emilykl emilykl self-assigned this Aug 18, 2025
@camdecoster
Copy link
Contributor

As we discussed, with this change, I think that this section can be removed:

if(pathToBundle.endsWith('.js')) {
var len = pathToBundle.length;
var cssOutput = pathToBundle.slice(0, len - 3) + '.css';
// remove unwanted css file
if (fs.existsSync(cssOutput)) {
fs.unlinkSync(cssOutput);
}
}

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.

2 participants