From 44a0028b8bbe54a7b1b8ee8b72e030148f35ca63 Mon Sep 17 00:00:00 2001 From: Thales <> Date: Wed, 9 Sep 2026 15:44:33 +0100 Subject: [PATCH 1/2] fix(import): accept a file dropped anywhere, and say why one is refused Dropping an audio file anywhere except the URL zone was left to the browser, which navigates to it. In a tab that is merely surprising. In the desktop shell there is no address bar and no back button, so the window is replaced by the webview's bare media player and the only way out is to quit the app, which is what the reporter hit with a .ogg. A file dropped anywhere in the window is now treated as a drop on the URL zone. Preventing the default is what stops the navigation; routing it to applyFiles is what makes the gesture do the obvious thing rather than nothing. The URL zone keeps its hover highlight, so it still shows where the file is going. Both handlers are guarded on the drag carrying "Files", so the library's own drags -- tracks between folders, into the lanes, onto the trash -- are untouched. Their handlers already bail before preventDefault when the drag is not theirs, so the two never see each other's gestures. A refused file now answers in the box it was aimed at, in red, rather than in the error panel. That panel is for a job that failed: it takes over a region and carries a retry button, and a file declined before anything started has nothing to retry. Both hard refusals use it, unsupported format and too large, because two different mechanisms for two refusals in the same gesture is how the next report gets written. The partial-skip case still uses the panel: files were accepted there, so it is a note rather than a refusal. The message clears on the next drop, on typing, and after six seconds, so it can never sit beside an armed file describing something else. Found while doing this, and worth knowing: static/css/widgets.css is not loaded by index.html and is referenced by nothing. The styling for this went in there first and was invisible, which the test caught only because it asserts the computed colour rather than the presence of a class. Left alone here; it wants its own look. tests/e2e/file-drop.spec.mjs covers a drop on the body arming the import, the same with a track open, the refusal being visible and red and hiding the input, a refusal clearing when something valid arrives or when the user types, and a library drag not being mistaken for a file. The navigation itself cannot be asserted: a synthetic drop never triggers the browser's real navigation, so a page.url() check passes with the fix removed and proves nothing. The tests assert the drop's default was cancelled instead, which is the mechanism that prevents it. Verified against the previous behaviour: four of the seven fail. Closes #584 --- static/css/daw.css | 19 ++++ static/index.html | 5 + static/js/main.js | 65 +++++++++++-- tests/e2e/file-drop.spec.mjs | 183 +++++++++++++++++++++++++++++++++++ 4 files changed, 266 insertions(+), 6 deletions(-) create mode 100644 tests/e2e/file-drop.spec.mjs diff --git a/static/css/daw.css b/static/css/daw.css index 0a034dda..30da6ad9 100644 --- a/static/css/daw.css +++ b/static/css/daw.css @@ -183,6 +183,25 @@ input, textarea { font-family: inherit; } } .daw-url-zone.has-file #url { display: none; } +/* Why a dropped file was refused, said in the box it was aimed at. + The full error panel is for a job that failed: it takes a region and carries + a retry button, and a file declined before anything started has nothing to + retry. Sits where the input text does, and hides it, so the box says one + thing at a time (#584). */ +.url-drop-error { + flex: 1; + min-width: 0; + color: var(--danger); + font-size: 13px; + line-height: 1.25; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +/* :has(), not a sibling combinator: the message follows the input in the + markup, so `~` points the wrong way. */ +.daw-url-zone:has(.url-drop-error:not(.hidden)) #url { display: none; } + /* Composer vertical divider */ .daw-composer-sep { width: 1px; diff --git a/static/index.html b/static/index.html index 805db14a..d7862198 100644 --- a/static/index.html +++ b/static/index.html @@ -50,6 +50,11 @@ spellcheck="false" autocomplete="off" /> + +