?
avatar frogydiak
frogydiak
1 Feb 2018

Steps to reproduce the issue

I'm developing a template in J!4 and using jQuery UI sortable. Please see screen capture.

https://monosnap.com/file/uEbLYVEqhLRMxyStGmSfg2zRX72iPJ

The switcher fields are inside modal, every time I move a sortable element and open the modal, the switcher field is duplicated. I move the element again, switcher will be triplicated and so on. That behavior only happened to the moved sortable element.

Expected result

Switcher should not duplicate itself when the element container is moved.

Actual result

Switcher field is duplicating itself by the how many times I move the container element.

avatar frogydiak frogydiak - open - 1 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 1 Feb 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 1 Feb 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Feb 2018
Build staging 4.0-dev
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 1 Feb 2018

Changed Build from "staging" to "4.0-dev".


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19517.

avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Feb 2018
Category Templates (site)
avatar dgt41
dgt41 - comment - 1 Feb 2018

I'm developing a template in J!4 and using jQuery UI

Good luck with that ?

avatar C-Lodder
C-Lodder - comment - 1 Feb 2018

Please try testing with this PR applied to your site: #19184

avatar dgt41
dgt41 - comment - 1 Feb 2018

Now a serious answer:

  • Jquery ui will not be part of joomla 4
  • modals will not be bootstrap modals
  • switcher IS a custom element

A note on the last one ☝️:
Custom elements have some lifecycle events which will be triggered on the appropriate event. It’s the same logic that vue, angular, react and every other modern js lib is using. The problem is that you try to use a dinosaur ? script with cutting edge technology and that obsiously doesn’t work pretty nice. I suspect the your script somehow triggers the connected callback (the element is inserted in the don) and that triggers all the logic that is bound to it in the custom element (eg create a new node)

Easy way out:

Use https://github.com/schne324/dragon-drop which is also fully accessible instead of the deprecated jquery ui

avatar frogydiak
frogydiak - comment - 1 Feb 2018

@dgt41 Eh? There's a jquery-ui folder under media/vendor and that's what I used. Is that to be removed in J4?

avatar frogydiak
frogydiak - comment - 1 Feb 2018

@C-Lodder Thanks for your suggestion, I actually created a modified version of subform field to create my layout field. Subform field does become convoluted when there are more fields and it does look confusing. I actually use it at first going to route of creating my own. It is good for just 2-3 subform fields but once you go over, not a good UI design.

avatar dgt41
dgt41 - comment - 1 Feb 2018

Yes, jquery ui will not ship in j4

avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Feb 2018
Status New Discussion
avatar C-Lodder
C-Lodder - comment - 1 Feb 2018

@frogydiak Yes it will be removed in J4. That's what the PR I linked you to do. It converts the jQuery UI sortable feature to a custom element. Would be great if you can test as this is a pretty big/complex task so any feedback would be great.

avatar frogydiak
frogydiak - comment - 1 Feb 2018

I see... thanks for the info. I didn't know... bummer! Someone has to clean up the 4.0-dev branch folders.

@C-Lodder I'll check Dragon DragnDrop. Thanks!

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 2 Feb 2018

@frogydiak can you please close this Issue?

avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Feb 2018
Status Discussion Information Required
avatar brianteeman brianteeman - change - 2 Feb 2018
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2018-02-02 14:50:30
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 2 Feb 2018

Closed

avatar brianteeman brianteeman - close - 2 Feb 2018

Add a Comment

Login with GitHub to post a comment