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

🐛 Treating synthetic PointerEvent on removeVanillaNestedFields #61

Closed

Conversation

lenilsonjr
Copy link

Hi there 👋

This is a great library, thanks for maintaining it!

I faced the same issue as #47 when using vanilla-nested with Turbo, and pointing my gem to the main branch of the repo solved it (kudos for the fix).

However, it seems that the changes here introduced a edge-case error that I could trace to removeVanillaNestedFields receiving a synthetic PointerEvent instead of the expected element directly, under some circumstances. I added a small conditional with this PR to deal with both cases.

It seems that the synthetic event is only sent when removing nested fields added by clicking on the link generated by link_to_add_nested.

This may not be the best fix (and I may not understand the underlying reason this is happening), but I thought I'd send this PR and document the fix and the error anyway.

Tested on Chrome.

Thanks!

CleanShot 2022-07-13 at 21 39 06

@arielj
Copy link
Owner

arielj commented Jul 13, 2022

thank you! I'll try to review the fix today or tomorrow, after that I'll make a new relase, thanks!

@arielj
Copy link
Owner

arielj commented Jul 17, 2022

thanks! after checking this I found the actual root cause of the problem so now it should always receive an HTMLElement

For reference: 166835d

I'll make a new release in a moment

@arielj arielj closed this Jul 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants