Currently, legends associated with layers in overlayGroups will toggle on/off via the layer selection, but legends associated with layers in baseGroups are always shown, regardless of which basegroup layer is selected. Not sure if this is a bug.
Expected behavior: Only the legend of the selected layer is shown.
Actual behavior: all legends for all layers are shown, regardless of selection.
Workaround: use overlayGroups instead of baseGroups in addLayersControl(), although this is suboptimal for cases where only one layer in the group should be selectable.
Currently, legends associated with layers in
overlayGroups
will toggle on/off via the layer selection, but legends associated with layers inbaseGroups
are always shown, regardless of which basegroup layer is selected. Not sure if this is a bug.Reprex:
Expected behavior: Only the legend of the selected layer is shown.
Actual behavior: all legends for all layers are shown, regardless of selection.
Workaround: use
overlayGroups
instead ofbaseGroups
inaddLayersControl()
, although this is suboptimal for cases where only one layer in the group should be selectable.See also https://github.com/rstudio/leaflet/issues/654