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

useDrag: add support for isDisabled #6254

Merged
merged 4 commits into from
Apr 24, 2024
Merged

useDrag: add support for isDisabled #6254

merged 4 commits into from
Apr 24, 2024

Conversation

reidbarber
Copy link
Member

@reidbarber reidbarber commented Apr 23, 2024

For parity with useDrop and useClipboard

✅ 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:

Check new story and tests

🧢 Your Project:

RSP

@rspbot
Copy link

rspbot commented Apr 23, 2024

@adobe adobe deleted a comment from rspbot Apr 23, 2024
@rspbot
Copy link

rspbot commented Apr 23, 2024

LFDanLu
LFDanLu previously approved these changes Apr 23, 2024
packages/@react-aria/dnd/src/useDrag.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

was thinking about what should happen if the drag target becomes disabled in the middle of a drag operation (e.g. keyboard dnd). I think the current behavior is fine (aka you can still complete the drop part of your current drag operation) but open question for the team in case there were any other opinions.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we would have to stop the drag session, and that would be a bit weird. Open to implementing that though, if thats what we want to do.

@rspbot
Copy link

rspbot commented Apr 24, 2024

@rspbot
Copy link

rspbot commented Apr 24, 2024

@rspbot
Copy link

rspbot commented Apr 24, 2024

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

@react-aria/dnd

DragOptions

 DragOptions {
   getAllowedDropOperations?: () => Array<DropOperation>
   getItems: () => Array<DragItem>
   hasDragButton?: boolean
+  isDisabled?: boolean
   onDragEnd?: (DragEndEvent) => void
   onDragMove?: (DragMoveEvent) => void
   onDragStart?: (DragStartEvent) => void
   preview?: RefObject<DragPreviewRenderer>
 

it changed:

  • useDrag

@reidbarber reidbarber merged commit a597a0c into main Apr 24, 2024
25 checks passed
@reidbarber reidbarber deleted the useDrag-isDisabled branch April 24, 2024 05:20
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.

None yet

6 participants