Skip to content

Custom library config overrides 'More Shapes' visibility toggles for left panel #5491

@cdeal

Description

@cdeal

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Describe the bug
Custom library entries defined in config.libraries always appear as checked/enabled in the + More Shapes dialog, regardless of whether their IDs are included in defaultLibraries. This makes it impossible to define custom libraries that are available in + More Shapes but not enabled by default — which is the expected behavior based on the configuration documentation describing defaultLibraries as controlling which libraries are "initially displayed in the left panel."

To Reproduce
Steps to reproduce the behavior:

  1. Open browser Developer Tools > Application > Local Storage > https://app.diagrams.net
  2. Delete .drawio-config if it exists
  3. Set .configuration to the following JSON (a minimal reproduction with two custom entries, only one in defaultLibraries):
{
  "libraries": [
    {
      "title": { "main": "Custom" },
      "entries": [
        {
          "id": "should-show",
          "title": { "main": "Should Show" },
          "desc": { "main": "This library should be visible by default" },
          "libs": [{ "title": { "main": "Should Show" }, "url": "https://jgraph.github.io/drawio-libs/libs/templates.xml" }]
        },
        {
          "id": "should-hide",
          "title": { "main": "Should Hide" },
          "desc": { "main": "This should appear in More Shapes but be unchecked by default" },
          "libs": [{ "title": { "main": "Should Hide" }, "url": "https://jgraph.github.io/drawio-libs/libs/templates.xml" }]
        }
      ]
    }
  ],
  "defaultLibraries": "should-show;general;uml;er;bpmn;flowchart;basic;arrows2",
  "enabledLibraries": null
}
  1. Reload the page — the sidebar correctly shows only "Should Show" in the left panel
  2. Click + More Shapes at the bottom of the left panel
  3. Observe that "Should Show" is checked and "Should Hide" is un-checked.
  4. Leave the options as is and click Apply.
  5. Both custom libraries now appear in the sidebar even though "Should Hide" was left unchecked.

Expected behavior
In step 8, "Should Hide" should not be added it to the sidebar.

Screenshots
[drawio-lib-bug.gif]

draw.io version (In the Help->About menu of the draw.io editor):

  • draw.io version: v29.6.0

Desktop (please complete the following information):

  • OS: Windows 11 Enterprise, version 23H2
  • Browser: Google Chrome
  • Browser Version: Version 144.0.7559.97 (Official Build) (64-bit)

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser N/A
  • Version N/A

I tested the problem in incognito/private mode with all browser extensions switched off, write "yes" below:

  • yes

Additional context
Please note the following was generated by Claude Code after deeply analyzing the issue along with DrawIO's source code. While I am not deeply technical, the description does make sense as it appears the + More Shapes is default checking all of the custom library entries behind the scenes even though you can visibly see the checkboxes checked.

FYI, I am not using defaultCustomLibraries as there are many icon options and a user might not want to load all of them. The behavior is much more dynamic and professional to have the options loaded but only certain ones defaulted. They can then simply check or uncheck each custom library as needed, without having to manually load/unload or re-apply a new config.

Claude Code analysis:

The root cause appears to be in Sidebar.js. The isEntryVisible() method determines checkbox state in MoreShapesDialog by checking whether the custom entry's palette DOM elements have display != 'none':

var elts = this.palettes[entry.id + '.0'];
if (elts != null) {
    return elts[0].style.display != 'none';
}
return false;

It appears that addCustomEntries() creates palette elements for all entries in config.libraries in a visible state, and showEntries() either runs before the palettes are fully created or does not successfully set display: none on non-default custom entry palettes. As a result, isEntryVisible() returns true for all custom entries when the More Shapes dialog opens, regardless of defaultLibraries.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions