madeyourday/contao-rocksolid-custom-elements

Unable to add new elements in list wizard in Contao 5.1

Closed this issue · 4 comments

Hey Martin, the extension does not work properly in Contao 5.1. It is not possible to add new elements to the list wizard due to JS error being thrown here:

https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/master/src/Resources/public/js/be_main.js#L228

CleanShot 2023-02-07 at 11 50 03

I am not sure what happens but the drag element is missing the rsce_list_toolbar_drag CSS class:

<img class="color-scheme--light" src="/system/themes/flexible/icons/drag.svg" width="16" height="16" alt="Move the item via drag and drop" loading="lazy" title="Move the item via drag and drop">

I wanted to create a pull request, but now I wonder whether we should just change the JS to match the selector:

-toolbar.getFirst('.rsce_list_toolbar_drag').setStyle('display', count < 2 ? 'none' : '');
+toolbar.getFirst('img[src$="drag.svg"]').setStyle('display', count < 2 ? 'none' : '');

… or shall we investigate what changed between Contao 4 and 5. Also, it seems that drag and drop no longer works at all (even with the fix above).

Please let me know if I should investigate it further myself, or if you already know what happened and how to fix it 🙂

ausi commented

So, only Contao 5.1.0-RC2 is affected and Contao 5.0 works fine, right?

I did not test it on Contao 5.0 to be honest, the only Contao 5 setup I have right now is 5.1.0-RC2.

ausi commented

Should be fixed with b14c714 @qzminski please verify.

Ah the markup has changed. It works like a charm now, thanks a lot Martin!