diff --git a/.changeset/chilly-squids-talk.md b/.changeset/chilly-squids-talk.md new file mode 100644 index 000000000..3a9377e71 --- /dev/null +++ b/.changeset/chilly-squids-talk.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/tree": patch +--- + +fix: 修复 Firefox 中组件拖拽报错问题 diff --git a/.changeset/lemon-fireants-glow.md b/.changeset/lemon-fireants-glow.md new file mode 100644 index 000000000..1ee2ece32 --- /dev/null +++ b/.changeset/lemon-fireants-glow.md @@ -0,0 +1,5 @@ +--- +"@hi-ui/hiui": patch +--- + +fix(tree): 修复 Firefox 中组件拖拽报错问题 diff --git a/packages/ui/tree/src/TreeNode.tsx b/packages/ui/tree/src/TreeNode.tsx index c1ded2867..ec3810735 100644 --- a/packages/ui/tree/src/TreeNode.tsx +++ b/packages/ui/tree/src/TreeNode.tsx @@ -92,6 +92,8 @@ export const TreeNode = forwardRef((props, const { id } = eventNodeRef.current + // 清空数据,下面会重新设置 + evt.dataTransfer.clearData() evt.stopPropagation() setIsDragging(true) @@ -108,7 +110,9 @@ export const TreeNode = forwardRef((props, (evt: React.DragEvent) => { evt.preventDefault() evt.stopPropagation() - evt.dataTransfer.clearData() + // issue: https://github.com/XiaoMi/hiui/issues/2941 + // 在firefox中拖拽结束后,清除数据会报错,Modifications are not allowed for this document,所以这里注释掉 + // evt.dataTransfer.clearData() dragNodeRef.current = null setDirection(null) setIsDragging(false)