Skip to content

Marker label className property not applying styles #159

@paodb

Description

@paodb

Describe the bug

This issue is related to the recently merged feature that introduced support for marker labels.

Currently, the new className property on labels does not work as expected. Even if a className is set, styles defined in the theme or external CSS are not applied because the label element is rendered inside the shadow DOM and is not exposed for styling (see #157 for more details).

Expected behavior

Styles defined for the className should apply to the marker label.

Minimal reproducible example

Steps to reproduce the issue:
1 - Add a marker with a label and set a className for it

GoogleMapMarker marker = new GoogleMapMarker("New Marker", gmaps.getCenter(), true, Markers.PURPLE);
MarkerLabel label = new MarkerLabel(labelText.getValue());
label.setColor("white");
label.setClassName("my-label-class-name");
marker.setLabel(label);
gmaps.addMarker(marker);

2 - Define styles in your theme for that class or main stylesheet. For example:

.my-label-class-name {
  background-color: blue;
}

3 - Observe that styles are not applied to the label.

Add-on Version

2.3.0-SNAPSHOT

Vaadin Version

24.8.x

Additional information

When tested in the JSFiddle example given in the documentation, the feature works as expected.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Under consideration

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions