DROP-ANYWHERE: drop a file anywhere in the chat to attach it, with a drop square #309

Merged
kompas-review merged 1 commit from khyretos/drop-anywhere into main 2026-10-28 10:18:09 +01:00
Owner

DROP-ANYWHERE: drag and drop of files into the chat was broken.

The drop handlers lived only on the composer box, so a file dropped on the messages (or anywhere else) was opened by the browser instead of attached.

  • A file dragged over the window shows a dashed square with an upload icon ("Drop files to attach").
  • Dropping anywhere attaches it, the same path as the paperclip, paste and the composer.
  • Only real file drags count (types includes Files): dragged text and task cards are untouched.
  • A native <input type=file> still handles its own drops.
  • Tests: drop on the messages area shows the overlay, cancels dragover and attaches; a text drag shows nothing. All 8 attach tests pass, tsc --noEmit is clean.
DROP-ANYWHERE: drag and drop of files into the chat was broken. The drop handlers lived only on the composer box, so a file dropped on the messages (or anywhere else) was opened by the browser instead of attached. - A file dragged over the window shows a dashed square with an upload icon ("Drop files to attach"). - Dropping anywhere attaches it, the same path as the paperclip, paste and the composer. - Only real file drags count (`types` includes `Files`): dragged text and task cards are untouched. - A native `<input type=file>` still handles its own drops. - Tests: drop on the messages area shows the overlay, cancels `dragover` and attaches; a text drag shows nothing. All 8 attach tests pass, `tsc --noEmit` is clean.
DROP-ANYWHERE: dropping a file anywhere in the window attaches it, with a dashed drop square and upload icon
All checks were successful
build / skills (pull_request) Successful in 10s
build / web (pull_request) Successful in 18s
build / runner (pull_request) Successful in 8s
fresh-install / fresh-install (pull_request) Successful in 10s
build / runner-windows (pull_request) Successful in 31s
review-gate / sweep (pull_request) Successful in 8s
lint / megalinter (pull_request) Successful in 54s
build / server (pull_request) Successful in 2m40s
review-gate / gate review findings are all handled
build / web-live (pull_request) Successful in 24m49s
kk / all-checks All 9 checks passed
3811bd5ba5
kompas-review scheduled this pull request to auto merge when all checks succeed 2026-10-28 09:53:12 +01:00
Collaborator

Title

DROP-ANYWHERE: drop a file anywhere in the chat to attach it, with a drop square


User description

DROP-ANYWHERE: drag and drop of files into the chat was broken.

The drop handlers lived only on the composer box, so a file dropped on the messages (or anywhere else) was opened by the browser instead of attached.

  • A file dragged over the window shows a dashed square with an upload icon ("Drop files to attach").
  • Dropping anywhere attaches it, the same path as the paperclip, paste and the composer.
  • Only real file drags count (types includes Files): dragged text and task cards are untouched.
  • A native <input type=file> still handles its own drops.
  • Tests: drop on the messages area shows the overlay, cancels dragover and attaches; a text drag shows nothing. All 8 attach tests pass, tsc --noEmit is clean.

PR Type

Enhancement


Description

  • Enables file attachment by dropping anywhere in the chat window.

  • Shows a dashed drop square with an upload icon on drag-over.

  • Prevents browser default behavior to open dropped files directly.

  • Adds tests for new drop-anywhere functionality and non-file drags.


Diagram Walkthrough

flowchart LR
  User["User drags file"] --> Overlay["Drop overlay appears"]
  Overlay --> DragOver["dragover event cancelled"]
  DragOver --> Drop["drop event handled"]
  Drop --> Attach["File attached to chat"]
  User -.->|"Non-file drag"| Nothing["No overlay shown"]

File Walkthrough

Relevant files
Enhancement
main.ts
Implement global drag-and-drop handlers for file attachment

web/src/main.ts

  • Moved drag-and-drop handlers from composer-wrap to document level.
  • Added logic to detect file types and ignore native file inputs.
  • Created a global drop overlay with an upload icon for visual feedback.
  • Updated event listeners to show/hide overlay based on drag depth.
+19/-8   
Miscellaneous
icons.ts
Add upload icon SVG path for drop overlay                               

web/src/views/icons.ts

  • Added SVG path definition for the new "upload" icon used in the drop
    overlay.
+1/-0     
Tests
attach.spec.ts
Add tests for drop-anywhere file attachment feature           

web/tests/attach.spec.ts

  • Added test verifying drop overlay visibility and file attachment on
    any drop.
  • Added test ensuring non-file drags do not trigger the overlay.
+33/-0   
Documentation
styles.css
Add CSS styles for global drop overlay component                 

web/src/styles.css

  • Defined styles for the new .drop-overlay and .drop-box elements.
  • Styled the dashed border, background, and centered layout of the drop
    box.
+6/-1     

## Title DROP-ANYWHERE: drop a file anywhere in the chat to attach it, with a drop square ___ ### **User description** DROP-ANYWHERE: drag and drop of files into the chat was broken. The drop handlers lived only on the composer box, so a file dropped on the messages (or anywhere else) was opened by the browser instead of attached. - A file dragged over the window shows a dashed square with an upload icon ("Drop files to attach"). - Dropping anywhere attaches it, the same path as the paperclip, paste and the composer. - Only real file drags count (`types` includes `Files`): dragged text and task cards are untouched. - A native `<input type=file>` still handles its own drops. - Tests: drop on the messages area shows the overlay, cancels `dragover` and attaches; a text drag shows nothing. All 8 attach tests pass, `tsc --noEmit` is clean. ___ ### **PR Type** Enhancement ___ ### **Description** - Enables file attachment by dropping anywhere in the chat window. - Shows a dashed drop square with an upload icon on drag-over. - Prevents browser default behavior to open dropped files directly. - Adds tests for new drop-anywhere functionality and non-file drags. ___ ### Diagram Walkthrough ```mermaid flowchart LR User["User drags file"] --> Overlay["Drop overlay appears"] Overlay --> DragOver["dragover event cancelled"] DragOver --> Drop["drop event handled"] Drop --> Attach["File attached to chat"] User -.->|"Non-file drag"| Nothing["No overlay shown"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>main.ts</strong><dd><code>Implement global drag-and-drop handlers for file attachment</code></dd></summary> <hr> web/src/main.ts <ul><li>Moved drag-and-drop handlers from composer-wrap to document level.<br> <li> Added logic to detect file types and ignore native file inputs.<br> <li> Created a global drop overlay with an upload icon for visual feedback.<br> <li> Updated event listeners to show/hide overlay based on drag depth.</ul> </details> </td> <td><a href="https://git.kreative-kompas.com/khyretos/kreative-kompanion/src/branch/khyretos/drop-anywhere/web/src/main.ts">+19/-8</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Miscellaneous</strong></td><td><table> <tr> <td> <details> <summary><strong>icons.ts</strong><dd><code>Add upload icon SVG path for drop overlay</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> web/src/views/icons.ts <ul><li>Added SVG path definition for the new "upload" icon used in the drop <br>overlay.</ul> </details> </td> <td><a href="https://git.kreative-kompas.com/khyretos/kreative-kompanion/src/branch/khyretos/drop-anywhere/web/src/views/icons.ts">+1/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>attach.spec.ts</strong><dd><code>Add tests for drop-anywhere file attachment feature</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> web/tests/attach.spec.ts <ul><li>Added test verifying drop overlay visibility and file attachment on <br>any drop.<br> <li> Added test ensuring non-file drags do not trigger the overlay.</ul> </details> </td> <td><a href="https://git.kreative-kompas.com/khyretos/kreative-kompanion/src/branch/khyretos/drop-anywhere/web/tests/attach.spec.ts">+33/-0</a>&nbsp; &nbsp; </td> </tr> </table></td></tr><tr><td><strong>Documentation</strong></td><td><table> <tr> <td> <details> <summary><strong>styles.css</strong><dd><code>Add CSS styles for global drop overlay component</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> web/src/styles.css <ul><li>Defined styles for the new .drop-overlay and .drop-box elements.<br> <li> Styled the dashed border, background, and centered layout of the drop <br>box.</ul> </details> </td> <td><a href="https://git.kreative-kompas.com/khyretos/kreative-kompanion/src/branch/khyretos/drop-anywhere/web/src/styles.css">+6/-1</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
Collaborator

PR Reviewer Guide 🔍

(Review updated until commit 3811bd5ba5)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
## PR Reviewer Guide 🔍 <!-- pr-agent:review:full --> #### (Review updated until commit https://git.kreative-kompas.com/khyretos/kreative-kompanion/commit/3811bd5ba5b2700d0fc06b6df3e8304395199b77) Here are some key observations to aid the review process: <table> <tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 2 🔵🔵⚪⚪⚪</td></tr> <tr><td>🧪&nbsp;<strong>PR contains tests</strong></td></tr> <tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr> <tr><td>⚡&nbsp;<strong>No major issues detected</strong></td></tr> </table>
Collaborator

PR Code Suggestions ✨

No code suggestions found for the PR.

## PR Code Suggestions ✨ <!-- pr-agent:improve:no-suggestions --> No code suggestions found for the PR.

🧹 Lint report · ✅ all 25 checks clean

Errors below fail this check.

✅ Clean: black, checkstyle, djlint, editorconfig-checker, git_diff, gitleaks, grype, hadolint, htmlhint, isort, jsonlint, markdownlint, npm-groovy-lint, pmd, prettier, prettier, ruff, secretlint, shellcheck, shfmt, stylelint, trivy, trufflehog, xmllint, yamllint

MegaLinter on soucouyant · full logs in the Actions run · comment /improve for AI fix suggestions

<!-- kk-lint --> ## 🧹 Lint report · ✅ all 25 checks clean Errors below fail this check. ✅ Clean: black, checkstyle, djlint, editorconfig-checker, git_diff, gitleaks, grype, hadolint, htmlhint, isort, jsonlint, markdownlint, npm-groovy-lint, pmd, prettier, prettier, ruff, secretlint, shellcheck, shfmt, stylelint, trivy, trufflehog, xmllint, yamllint <sub>MegaLinter on soucouyant · full logs in the Actions run · comment <code>/improve</code> for AI fix suggestions</sub>
Collaborator

/review

/review
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
khyretos/kreative-kompanion!309
No description provided.