forge
Explore
Log in

Don't you dare go Hollow

Drop the visible file chooser from the files panel

Browse files at this commit

9e827a055109876e3b4cc5ec78d786cd195c932aAhmet Kaan GümüşParent: 45563b3
  • fix
    • drop the visible file chooser from the files panel
Show full message
fix(ui): drop the visible file chooser from the files panel

The + menu's Upload files covers picking (a label-for on the same
input, so it works without script), and the "Drop files here" note
described a handler that never existed. The input stays in the DOM,
visually hidden as before; the upload script's progress host falls back
to the form when no chooser box is present.
crates/in-web/src/drive.rsmodified+5 -6
@@ -370,11 +370,10 @@ async fn drive(cx: &Cx) -> Result {
370370 <form id="upload-form" class="file-upload" method="post" action="/files"
371371 enctype="multipart/form-data" data-hard="" data-failed-label=(t(language, Key::UploadFailed))>
372372 <input type="hidden" name="folder_id" value=(current_id.clone())>
373- <label class="file-upload-box">
374- <span class="file-upload-name">(t(language, Key::ChooseFiles))</span>
375- <input id="drive-upload-input" class="file-upload-input" type="file" name="file" multiple="">
376- </label>
377- <span class="field-note">(t(language, Key::DropFilesHere))</span>
373+ // No visible chooser here: the + menu's "Upload files"
374+ // label targets this input. It stays in the DOM, display-
375+ // none via the file-upload-input rule.
376+ <input id="drive-upload-input" class="file-upload-input" type="file" name="file" multiple="">
378377 </form>
379378 <div class="file-list">
380379 for file in listing.files.iter() {
@@ -515,7 +514,7 @@ async fn upload_script(cx: &Cx) -> Result {
515514 if (!form || form.id !== 'upload-form') { return; } \
516515 e.preventDefault(); \
517516 var input = form.querySelector('.file-upload-input'); \
518- var box = form.querySelector('.file-upload-box'); \
517+ var box = form.querySelector('.file-upload-box') || form; \
519518 var folder = form.querySelector('input[name=folder_id]').value; \
520519 var files = input && input.files ? Array.prototype.slice.call(input.files) : []; \
521520 if (!files.length) { return; } \