diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/sorter/sorter.controller.ts b/src/Umbraco.Web.UI.Client/src/packages/core/sorter/sorter.controller.ts index e73da7be7a..95815ca394 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/sorter/sorter.controller.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/sorter/sorter.controller.ts @@ -82,7 +82,7 @@ type INTERNAL_UmbSorterConfig = { * A query selector for the item element. */ itemSelector: string; - //disabledItemSelector?: string; + disabledItemSelector?: string; /** * A selector for the container element, if not defined the host element will be used as container. */ @@ -333,12 +333,12 @@ export class UmbSorterController ' + this.#config.disabledItemSelector)) { - // Idea: to make sure on does not get initialized twice: if ((element as HTMLElement).draggable === true) return; - (element as HTMLElement).draggable = true; - element.addEventListener('dragstart', this.#handleDragStart); - element.addEventListener('dragend', this.#handleDragEnd); - //} + if (!this.#config.disabledItemSelector || !element.matches(this.#config.disabledItemSelector)) { + // Idea: to make sure on does not get initialized twice: if ((element as HTMLElement).draggable === true) return; + (element as HTMLElement).draggable = true; + element.addEventListener('dragstart', this.#handleDragStart); + element.addEventListener('dragend', this.#handleDragEnd); + } // If we have a currentItem and the element matches, we should set the currentElement to this element. if (