Skip to content

Fancytree with glyph extension does not toggle folder/caret glyph on expansion. Fix inside. #1032

@chrisparnin

Description

@chrisparnin

Expected and Actual Behavior

Expected:
image

Actual:
image

Steps to Reproduce the Problem

I can get the expected behavior, if I change glyph extension selector from span => svg, in two locations:

			span = $span.children("svg.fancytree-icon").get(0);
			if (span) {
				if (node.statusNodeType) {
					icon = node.statusNodeType; // loading, error
				} else if (node.folder) {
					icon =
						node.expanded && node.hasChildren()
							? "folderOpen"
							: "folder";
			span = $span.children("svg.fancytree-expander").get(0);
			if (span) {
				// if( node.isLoading() ){
				// icon = "loading";
				if (node.expanded && node.hasChildren()) {
					icon = "expanderOpen";

There is an existing fiddle that documents this behavior:

    // SGS remove "span", so it will work with svg or span tags
   span = $span.children(".fancytree-expander").get(0);

It appears there has been in inconsistent change somewhere or this fix did not make it into the published version for 2.36.1. Because in the DOM, I see the <span class="fancytree-expander">, but it is commented out below the svg.

<svg role="button" class="svg-inline--fa fa-caret-right fa-w-6 fancytree-expander" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="caret-right" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512" data-fa-i2svg=""><path fill="currentColor" d="M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z"></path></svg>

<!-- <span role="button" class="fancytree-expander  fas fa-caret-right"></span> -->

Glyph version with error:
https://cdn.jsdelivr.net/npm/[email protected]/dist/modules/jquery.fancytree.glyph.js

Environment

  • Browser type and version:
    Chrome/Firefox latest
  • jQuery and jQuery UI versions:
    3.5.1, 1.12.1
  • Fancytree version:
    enabled/affected extensions:
    2.36.1, with glpyh extension 2.36.1

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions