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: make a tag link draggable with usePress #7448

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mehm8128
Copy link
Contributor

@mehm8128 mehm8128 commented Nov 28, 2024

Closes #6618

I'm not sure this solution is proper to solve the issue so if there is some missing consideration please let me know πŸ™

βœ… Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

πŸ“ Test Instructions:

  1. open storybook Link Example http://localhost:9003/?path=/story/react-aria-components--link-example&providerSwitcher-express=false&strict=true
  2. Attempt to drag the link with a mouse

🧒 Your Project:

Comment on lines +942 to +944
if (target.tagName === 'A' && target.getAttribute('draggable') !== 'false') {
return false;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if target is a tag and doesn't have draggable="false" attr, we shouldn't prevent default to enable to drag the link

return false;
}

return !target.hasAttribute('draggable');
Copy link
Contributor Author

@mehm8128 mehm8128 Nov 28, 2024

Choose a reason for hiding this comment

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

Q: I think even if target element has draggable="false", target.hasAttribute('draggable') is true (because hasAttribute ignore its value), is it ok? or should we fix it to be !(target.getsAttribute('draggable') === "true");?

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.

Unable to drag and drop links
1 participant