Uncaught ReferenceError: Sortable is not defined
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3530981. -->
Reported by: [gorkagr](https://www.drupal.org/user/3479175)
Related to !154
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Hi!</p>
<p>Just installed the module to test as a replacement of select2. Found this error when changing from select2 to tagify one facet that already exists.<br>
when the view with the facet loads, i get the error:<br>
<code>Uncaught ReferenceError: Sortable is not defined (tagify-widget.js:142:9)</code><br>
and the normal functionality of the view with the facet stops, as the JS error</p>
<p>Going to that line in modules/tagify_facets/js/tagify-widget.js</p>
<pre> /**<br> * Binds Sortable to Tagify's main element and specifies draggable items.<br> */<br> Sortable.create(tagify.DOM.scope, {<br> draggable: `.${tagify.settings.classNames.tag}:not(tagify__input)`,<br> forceFallback: true,<br> onEnd() {<br> tagify.updateValueByDOMTags();<br> },<br> });</pre><p>checking hte definition in its libraries.yml, we dont see there <code>core/sortable</code> nor in the definition of the JS</p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Enable both modules<br>
Add a facet with tagify<br>
see the console inspector of the browser</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>I have tried to add 'core/sortable' to tagify_facets.libraries.yml and then Sortable to the JS in lines 7 and 183 after once, but did not worked for me.<br>
So i ended commenting lines 139-148 and the facet worked as expected and page functionality is good.</p>
<p>Could be the Sortable was left there by mistake and is not needed?</p>
issue