forge
Explore
Log in

Don't you dare go Hollow

A landed upload keeps its row as a press-away record — the cancel ✕ had nothing left to cancel, so the finished row drops it and clears itself on click or Enter

Browse files at this commit

6cb90b434736db49a391aa90e6ed68ff5ec04487Ahmet Kaan GümüşParent: dbcb288
  • fix
    • a landed upload keeps its row as a press-away record — the cancel ✕ had nothing left to cancel, so the finished row drops it and clears itself on click or Enter
Show full message
fix(web): a landed upload keeps its row as a press-away record — the cancel ✕ had nothing left to cancel, so the finished row drops it and clears itself on click or Enter
crates/in-web/src/drive.rsmodified+44 -14
@@ -559,9 +559,7 @@ async fn drive(cx: &Cx) -> Result {
559559 // owned and live opens nothing.
560560 let share_pair = params.as_ref().and_then(|query| query.share.as_deref());
561561 let share_dialog = match share_pair.and_then(|pair| pair.split_once(':')) {
562- Some((kind, id)) => {
563- crate::share::share_modal(cx, kind, id, &here, created.clone()).await?
564- }
562+ Some((kind, id)) => crate::share::share_modal(cx, kind, id, &here, created.clone()).await?,
565563 None => None,
566564 };
567565 // The move picker: `?move=kind:id` renders the destination modal over
@@ -915,6 +913,12 @@ fn query_value(query: &str, key: &str) -> Option<String> {
915913 /// so the row's ✕ keeps working across soft navigations — then the row
916914 /// drops and the canceled card announces through `window.__inNotify`.
917915 ///
916+/// A finished upload keeps its row — at 100 percent, without the ✕ (there
917+/// is nothing left to cancel once the bytes have landed) — and the row
918+/// itself becomes the dismissal: pressing it anywhere (click, Enter, Space)
919+/// drops it from the stack and the mirror, so the record lingers exactly
920+/// as long as the reader wants it.
921+///
918922 /// The form wears `data-hard` so the soft-nav's multipart replay leaves it
919923 /// alone — two uploaders racing the same bytes would double-insert, and the
920924 /// progress the soft-nav draws knows nothing of chunks. Without script the
@@ -990,21 +994,41 @@ async fn upload_script(cx: &Cx) -> Result {
990994 track.appendChild(fill); \
991995 var pct = document.createElement('span'); \
992996 pct.className = 'upload-progress-pct'; \
993- var shut = document.createElement('button'); \
994- shut.type = 'button'; \
995- shut.className = 'upload-progress-cancel'; \
996- shut.textContent = '✕'; \
997- if (u.cancelLabel) { shut.setAttribute('aria-label', u.cancelLabel); } \
998- shut.addEventListener('click', function () { \
999- shut.disabled = true; \
1000- if (u.cancel) { u.cancel(); } \
1001- }); \
997+ if (!u.done) { \
998+ var shut = document.createElement('button'); \
999+ shut.type = 'button'; \
1000+ shut.className = 'upload-progress-cancel'; \
1001+ shut.textContent = '✕'; \
1002+ if (u.cancelLabel) { shut.setAttribute('aria-label', u.cancelLabel); } \
1003+ shut.addEventListener('click', function () { \
1004+ shut.disabled = true; \
1005+ if (u.cancel) { u.cancel(); } \
1006+ }); \
1007+ row.appendChild(shut); \
1008+ } \
10021009 row.appendChild(name); \
10031010 row.appendChild(track); \
10041011 row.appendChild(pct); \
1005- row.appendChild(shut); \
10061012 box.appendChild(window.__inAdded(row)); \
10071013 } \
1014+ /* A finished upload turns its row into the completion \
1015+ notice: nothing is left to cancel — the bytes already \
1016+ landed — so the ✕ goes and the row's own press \
1017+ clears it. The flag on the node keeps a re-render \
1018+ from stacking handlers on one survivor. */ \
1019+ if (u.done && !row.__inDone) { \
1020+ row.__inDone = true; \
1021+ row.classList.add('upload-progress-done'); \
1022+ var old = row.querySelector('.upload-progress-cancel'); \
1023+ if (old) { old.remove(); } \
1024+ row.setAttribute('role', 'button'); \
1025+ row.setAttribute('tabindex', '0'); \
1026+ row.setAttribute('title', box.getAttribute('data-dismiss-label') || 'dismiss'); \
1027+ row.addEventListener('click', function () { dropRow(u); }); \
1028+ row.addEventListener('keydown', function (ev) { \
1029+ if (ev.key === 'Enter' || ev.key === ' ') { ev.preventDefault(); dropRow(u); } \
1030+ }); \
1031+ } \
10081032 var text = Math.min(100, Math.round(u.frac * 100)) + '%'; \
10091033 var fillNow = row.querySelector('.upload-progress-fill'); \
10101034 var pctNow = row.querySelector('.upload-progress-pct'); \
@@ -1048,6 +1072,11 @@ async fn upload_script(cx: &Cx) -> Result {
10481072 var row = box && findRow(box, u.id); \
10491073 if (row) { row.remove(); } \
10501074 } \
1075+ /* Completion keeps the row as a record instead of dropping it: \
1076+ the flag re-renders it read-only (no ✕) and press-clears, so \
1077+ a landed upload announces itself exactly as long as the \
1078+ reader wants it on screen. */ \
1079+ function finishRow(u) { u.done = true; renderUploads(); } \
10511080 document.addEventListener('in:wire', renderUploads); \
10521081 renderUploads(); \
10531082 function notify(kind, message) { \
@@ -1244,13 +1273,14 @@ async fn upload_script(cx: &Cx) -> Result {
12441273 var ui = bar(title); \
12451274 rows.push(ui); \
12461275 var url = await sendSmall(form.getAttribute('action'), folder, small, function (frac) { setProgress(ui, frac); }, ui); \
1276+ finishRow(ui); \
12471277 if (url) { landing = url; } \
12481278 } \
12491279 for (var i = 0; i < big.length; i++) { \
12501280 await (function (file) { \
12511281 var ui2 = bar(file.name); \
12521282 rows.push(ui2); \
1253- return sendBig(file, folder, function (frac) { setProgress(ui2, frac); }, ui2); \
1283+ return sendBig(file, folder, function (frac) { setProgress(ui2, frac); }, ui2).then(function () { finishRow(ui2); }); \
12541284 })(big[i]); \
12551285 } \
12561286 } catch (err) { \
style/main.scssmodified+10 -0
@@ -4653,6 +4653,16 @@ input[type="radio"] {
46534653 color: var(--muted-soft);
46544654 }
46554655
4656+// A finished row is its own dismissal: no cancel control is drawn (nothing
4657+// is left to cancel), so the press of the row has to read as the way out —
4658+// a pointer, and a hover that lifts the muted name to ink. The shared
4659+// `[tabindex]` ring rule covers keyboard focus.
4660+.upload-progress-done {
4661+ cursor: pointer;
4662+
4663+ &:hover .upload-progress-name { color: var(--ink); }
4664+}
4665+
46564666 // The full-page drop affordance: a fixed veil with the invitation centred,
46574667 // pointer-transparent so it never blocks the drop it announces.
46584668 .drop-overlay {