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

fix(angular-list): fix drag drop issue #3748

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

yinglejia
Copy link

Closes #

Summary

Bug: sometimes, when drag and drop an item in the Angular list component, the item may be removed from the list unexpectedly. It is difficult to reproduce on will. Console logging shows that when the problem happens, the list component received a dragEnd event but didn't receive a dropped event. That explains why the item is removed from the list - the dropped event handler adds a duplicate and the dragEnd event handler removes the original.

Fix: according to MDN https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#specifying_drop_targets, we need to prevent the default behavior by cancelling both the dragenter and dragover events. This PR adds event handler for dragenter. With this fix, I could no longer reproduce the problem.

If you want to allow a drop, you must prevent the default behavior by cancelling both the dragenter and dragover events.

Change List (commits, features, bugs, etc)

  • items_here

Acceptance Test (how to verify the PR)

  • tests here

Regression Test (how to make sure this PR doesn't break old functionality)

  • tests here

Things to look for during review

  • Make sure all references to iot or bx class prefix is using the prefix variable
  • (React) All major areas have a data-testid attribute. New test ids should have test written to ensure they are not changed or removed.
  • UI should be checked in RTL mode to ensure the proper handling of layout and text.
  • All strings should be translatable.
  • The code should pass a11y scans (The storybook a11y knob should show no violations). New components should have a11y test written.
  • Unit test should be written and should have a coverage of 90% or higher in all areas.
  • All components should be passing visual regression test. For new styles or components either a visual regression test should be written for all permutations or the base image updated.
  • Changes or new components should either write new or update existing documentation.
  • PR should link and close out an existing issue

@yinglejia yinglejia requested a review from a team as a code owner March 8, 2023 17:20
@netlify
Copy link

netlify bot commented Mar 8, 2023

Deploy Preview for carbon-addons-iot-react ready!

Name Link
🔨 Latest commit 6ed9898
🔍 Latest deploy log https://app.netlify.com/sites/carbon-addons-iot-react/deploys/6408c3c6b9d779000877205b
😎 Deploy Preview https://deploy-preview-3748--carbon-addons-iot-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants