Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drag: clone doesn't work if the element was created by code #264

Closed
martonp96 opened this issue Jan 14, 2022 · 2 comments
Closed

drag: clone doesn't work if the element was created by code #264

martonp96 opened this issue Jan 14, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@martonp96
Copy link

Hello,

Version: latest release (4.3)

This is the RML i used for the test: https://pastebin.com/sQsnLEGP

Code:

    auto leftBody = document->QuerySelector(".container-body-left > .flex-body");
    auto dragElem = document->CreateElement("div");
    dragElem->SetClass("flex-item", true);
    leftBody->AppendChild(std::move(dragElem)); 

You can see on the video that the left box which was there in the RML works, while the new i added on the right side doesn't work:

https://s10.gifyu.com/images/ezgif.com-gif-makeraf65bc5247eda091.gif

In the inspector both elements are the same, and the events are working correctly on both.

@mikke89 mikke89 added the bug Something isn't working label Jan 14, 2022
@mikke89
Copy link
Owner

mikke89 commented Jan 14, 2022

Hi, and thanks for the detailed report.

Tested it and I'm able to reproduce it. Looks like the element is actually cloned, it just doesn't get the classes that have been programmatically set applied to the clone. This again is because Element::SetClass doesn't actually modify the class attribute. I'll think a bit more about a proper way to solve this. Thanks for reporting!

@mikke89
Copy link
Owner

mikke89 commented Jan 17, 2022

Hopefully this fixes the issue for you. This issue is very much analogous to #218 and was fixed in the same manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants