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

Issue 205: Reset drag states when dropping, even on invalid targets #206

Merged

Conversation

cbroeren
Copy link
Collaborator

@cbroeren cbroeren commented Aug 19, 2024

Closes #205 : Dropping a dragged object into invalid target breaks the component sidebar

Description

After dropping any element on an invalid target, the component sidebar was staying disabled.

In this PR

  • Making sure that the drag state is being reset, even after dropping on an invalid target
  • Add a generic resetDrag function so we can trigger that from different places, and for future improvements keep the logic of resetting the state in one place

Before, it was just returning from the drop even handler when the target was invalid, but the draggedObject was still set. Therefore the app still thinks it's in drag mode, and disabling the component sidebar.

Testing Notes

  1. Open any of the page editors
  2. Use the sidebar to drag a component (any will work)
  3. Drop the component on the most outer wrapper (the fake browser content)
  4. Verify: The drag mode is reset and the component sidebar can be used again

Before / After

Before After
Stays in drag mode, component sidebar disabled Resets drag mode, interaction enabled
358613618-9fe7b037-193e-4ea4-8871-5cd6ef699055 205-reset-drag-on-invalid-after

@cbroeren cbroeren self-assigned this Aug 19, 2024
@cbroeren cbroeren requested a review from leandrocp August 19, 2024 17:33
Copy link
Contributor

@leandrocp leandrocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@cbroeren cbroeren merged commit 1b34282 into main Aug 19, 2024
3 checks passed
@cbroeren cbroeren deleted the cb/issue-205-broken-sidebar-after-dropping-on-invalid-target branch August 19, 2024 18:53
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.

Dropping a dragged object into invalid target breaks the component sidebar
2 participants