AnsweredAssumed Answered

[JSAPI 4.8 vs 4.7]LayerList with Legend widget shows unwanted text

Question asked by Justdoit011 on Jul 6, 2018
Latest reply on Oct 31, 2018 by Tui

I'm trying to add Legend into LayerList widget, using the same method as this example. When I test this with a multi-layer webmap, there are some unwanted "legend" text shown in the LayerList. See the screenshot below.


Unwanted texts


These unwanted "legend" texts only exist in v4.8 API. v4.7 is working perfectly as expected. Also, if I clicked the toggle button to hide and show legend panel, those texts will be gone. This behavior is seen in both latest Chrome and MS Edge browsers.


Texts disappeared after clicked toggle button


The source code is very simple:

// Add a legend instance to the panel of a
// ListItem in a LayerList instance
const layerList = new LayerList({
  view: view,
  listItemCreatedFunction: function (event) {
    const item = event.item;
    item.panel = {
      content: "legend",
      open: true


Below is a running example: