Skip to content
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

add a CSS fix for leaflet to avoid wider CSS to apply #896

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cderv
Copy link
Contributor

@cderv cderv commented Dec 8, 2023

CSS conflict happened in Quarto context where a rule on .legend was applying to Leaflet own legend box

Context of the issue at

When adding figure caption for a leaflet in Quarto, this will add some CSS bootstrap rules to the document. One being:

.quarto-figure-center>figure>p, .quarto-figure-center>figure>div {
    text-align: center;
}

This rules has effect on text inside the leaflet object !

image

I believe there should be a fix in leaflet CSS so that a default alignment is made on the legend box.

This PR does that.

If this is ok fix with you, question: Should visual test be added ?

If you think this shouldn't be done in leaflet R package, this is also ok. We'll probably add a rule in Quarto to not apply the Figure CSS rules on content under div.html-widget objects

I just figured this could happen in other context without this CSS patch.

CSS conflict happened in Quarto context where a rule on `.legend` was applying to Leaflet own legend box
Copy link
Member

@gadenbuie gadenbuie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cderv! I think we'll wait to see how the upstream issue is resolved first. I'm not completely opposed to this change, but it feels like this might be just one of many issues that arise (even just in leaflet) from Quarto setting text-align: center on the .htmlwidget element.

inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css Outdated Show resolved Hide resolved
Co-authored-by: Garrick Aden-Buie <garrick@adenbuie.com>
@cderv
Copy link
Contributor Author

cderv commented Dec 11, 2023

we'll wait to see how the upstream issue is resolved first.

Agree with that. I did try a PR initially there too, but I suggested also in comment there a specific rule for mermaid (as it seems the rule was added for that)

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