From 6717a8aedb973fd1e0d54e9e2619361e1a4c6526 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Fri, 8 Dec 2023 17:39:06 +0100 Subject: [PATCH 1/2] add a CSS fix for leaflet to avoid wider CSS to apply CSS conflict happened in Quarto context where a rule on `.legend` was applying to Leaflet own legend box --- NEWS.md | 2 ++ inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/NEWS.md b/NEWS.md index dc1d14a45..788b5d0fb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,8 @@ * Fixed #893: Correctly call `terra::crs()` when checking the CRS of a `SpatVector` object in `pointData()` or `polygonData()` (thanks @mkoohafkan, #894). +* Applying new CSS rule to patch leaflet by explicitly lefet aligning legend text content. + # leaflet 2.2.1 * When `addProviderTiles()` is used with `{leaflet.providers}` version 2.0.0 or later, the `leaflet-providers` HTML dependency produced can be correctly cached by knitr. When used with older versions of `{leaflet.providers}`, the HTML dependency uses temp files that break knitr's caching mechanism (thanks @qdread, @jaredlander; #884). diff --git a/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css b/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css index c10d2f113..527df39a4 100644 --- a/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css +++ b/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css @@ -39,3 +39,9 @@ Fix for https://github.com/rstudio/rmarkdown/issues/1949 */ max-width: none !important; max-height: none !important; } + +/* Add explicit alignment rule to avoid CSS wider CSS applying to legend content +Fix for https://github.com/quarto-dev/quarto-cli/issues/7843 */ +.leaflet .legend.leaflet-control { + text-align: left; +} From 27e75c28b2ef86eb09e4cd1cf8dc32f726afb005 Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 11 Dec 2023 09:56:15 +0100 Subject: [PATCH 2/2] Update inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css Co-authored-by: Garrick Aden-Buie --- inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css b/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css index 527df39a4..86b69e2f0 100644 --- a/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css +++ b/inst/htmlwidgets/lib/rstudio_leaflet/rstudio_leaflet.css @@ -42,6 +42,6 @@ Fix for https://github.com/rstudio/rmarkdown/issues/1949 */ /* Add explicit alignment rule to avoid CSS wider CSS applying to legend content Fix for https://github.com/quarto-dev/quarto-cli/issues/7843 */ -.leaflet .legend.leaflet-control { - text-align: left; +.leaflet .legend { + text-align: start; }