diff --git a/pkg/interface/src/views/apps/chat/components/chat.tsx b/pkg/interface/src/views/apps/chat/components/chat.tsx index 56fab6c72..18036660f 100644 --- a/pkg/interface/src/views/apps/chat/components/chat.tsx +++ b/pkg/interface/src/views/apps/chat/components/chat.tsx @@ -79,7 +79,7 @@ export class ChatScreen extends Component { } onDragEnter(event) { - if (!this.readyToUpload() || !event.dataTransfer.files.length) { + if (!this.readyToUpload() || (!event.dataTransfer.files.length && !event.dataTransfer.types.includes('Files'))) { return; } this.setState({ dragover: true }); @@ -149,7 +149,12 @@ export class ChatScreen extends Component { this.setState({ dragover: true }); } }} - onDragLeave={() => this.setState({ dragover: false })} + onDragLeave={(event) => { + const over = document.elementFromPoint(event.clientX, event.clientY); + if (!over || !event.currentTarget.contains(over)) { + this.setState({ dragover: false }); + }} + } onDrop={this.onDrop.bind(this)} > {this.state.dragover ? : null} diff --git a/pkg/interface/src/views/apps/chat/components/lib/ChatInput.tsx b/pkg/interface/src/views/apps/chat/components/lib/ChatInput.tsx index 200e02817..c0a1daa9f 100644 --- a/pkg/interface/src/views/apps/chat/components/lib/ChatInput.tsx +++ b/pkg/interface/src/views/apps/chat/components/lib/ChatInput.tsx @@ -160,10 +160,14 @@ export default class ChatInput extends Component if (!this.readyToUpload()) { return; } + if (!this.s3Uploader.current || !this.s3Uploader.current.inputRef.current) return; this.s3Uploader.current.inputRef.current.files = files; - const fire = document.createEvent("HTMLEvents"); - fire.initEvent("change", true, true); - this.s3Uploader.current?.inputRef.current?.dispatchEvent(fire); + setTimeout(() => { + if (this.s3Uploader.current.state.isUploading) return; + const fire = document.createEvent("HTMLEvents"); + fire.initEvent("change", true, true); + this.s3Uploader.current?.inputRef.current?.dispatchEvent(fire); + }, 200); } render() {