Umbraco-CMS: Search result in tree doesn't respect filter css class

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

10.2.1

Bug summary

When using treepicker infinite editor it is possible the use filterCssClass:

For example:

function openCategoryPicker() {

      const dialog = {
          entityType: "Document",
          filterCssClass: "not-allowed not-published",
          filter: function (item) {
              if (item.metaData.contentType !== "category" || item.hasChildren)
                  return true;

              return item.nodeType === "container" || item.metaData.isElement || !!_.findWhere(vm.itemTypes, { udi: item.udi });
          },
          currentNode: editorState ? editorState.current : null,
          submit: model => {
              if (Utilities.isArray(model.selection)) {
                  Utilities.forEach(model.selection, (item, i) => {
                      vm.add(item);
                  });
              } else {
                  vm.clear();
                  vm.add(model);
              }
              setDirty();
          },
          treeAlias: "content",
          section: "content",
          idType: "udi",
          close: () => editorService.close()
      };

      editorService.contentPicker(dialog);
}

In this example tree nodes with children are not allowed to select (only the ones without children).

However when searching in search input, it is possible to select these nodes anyway.

Specifics

No response

Steps to reproduce

Use treepicker infinite editor with filterCssClass property and filter function and notice than when search it is possible to select the nodes even though then should not be allowed to select.

Expected result / actual result

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (18 by maintainers)

Most upvoted comments

@Zeegaan could you try with the test dashboard attached here https://github.com/umbraco/Umbraco-CMS/issues/13337#issuecomment-1332069104 and the default starter kit.

When filtering “home” I also get that node in filter function, but excluded since its alias is not product. This is tested on v11/contrib branch.

image

However this issue was reported in v10.2.1, where it seemed the filter still returned the results, maybe because I only had item.metaData.contentType === "category and not also check on item.metaData.ContentTypeAlias === "category".

Yes, let’s close this for now 😁