forge
Explore
Log in

Don't you dare go Hollow

the pane is the tab's whole region: files-pane moves off the Files section onto .detail-body itself — the instrument panel pads the body 20px on every side, so no child of it can ever cover the rim a drop lands on, and the section's box stopped at its content while the empty space below answered to the body; conditional class! on the body when the Files tab is active, the section reverts to a plain detail-block, and dragleave keeps the mark only while the pointer stays inside the body — the tab strip is now the outside; the browser pass grows two legs, elementFromPoint at the body's bottom edge must answer files-pane and a fourth file dropped on that empty rim rides the same path to a fourth chip

Browse files at this commit

2571bb36939d49e59840449ba1841548de2b1b1fAhmet Kaan GümüşParent: 4f8f453
crates/iz-web/src/detail.rsmodified+16 -5
@@ -1671,7 +1671,16 @@ async fn subtask_row(
16711671 let release_title = t(lang, Key::ReleaseThisPart);
16721672 let mut faces = Vec::new();
16731673 for person in &part.assignees {
1674- faces.push(crate::layout::avatar(cx, &person.id, &person.display_name, person.photo_version, "").await?);
1674+ faces.push(
1675+ crate::layout::avatar(
1676+ cx,
1677+ &person.id,
1678+ &person.display_name,
1679+ person.photo_version,
1680+ "",
1681+ )
1682+ .await?,
1683+ );
16751684 }
16761685 view! {
16771686 cx =>
@@ -2138,7 +2147,11 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
21382147 </div>
21392148
21402149
2141- <div class="detail-body">
2150+ // The Files tab's whole region is the upload box's hit area:
2151+ // layout.rs's drag listeners catch a file dropped anywhere in
2152+ // this box — head, list, the empty space below — and land it
2153+ // on the box inside.
2154+ <div class=(class!("detail-body", "files-pane" if tab == Tab::Files))>
21422155 if tab == Tab::Task {
21432156
21442157
@@ -2183,9 +2196,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
21832196 }
21842197
21852198 if tab == Tab::Files {
2186- // The section is the upload box's hit area: layout.rs's
2187- // drag listeners catch a file dropped anywhere in it.
2188- <section class="detail-block files-pane">
2199+ <section class="detail-block">
21892200 <div class="detail-block-head">
21902201 <span class="detail-label">(t(lang, Key::Files))</span>
21912202 <span class="detail-count">(detail.files.len())</span>
crates/iz-web/tests/browser/drop.mjsmodified+62 -7
@@ -171,11 +171,11 @@ if (!failures.length) {
171171 }
172172
173173 // The same hand, dropped on the pane instead of the box: the Files tab's
174-// whole section is the box's hit area, so a drag parked over the list or
175-// the head marks the box, leaving the pane for the body unmarks it, and a
176-// drop on the list rides the same change path. Dispatched on the head and
177-// list nodes — children of the pane — to prove the closest() resolution,
178-// not a lucky direct hit on the section itself.
174+// whole region — the tab body itself, rim included — is the box's hit area,
175+// so a drag parked over the list or the head marks the box, leaving for the
176+// tab strip unmarks it, and a drop on the list rides the same change path.
177+// Dispatched on the head and list nodes — children of the pane — to prove
178+// the closest() resolution, not a lucky direct hit on the body itself.
179179 if (!failures.length) {
180180 const paneOver = await page.evaluate(() => {
181181 const head = document.querySelector('.files-pane .detail-block-head');
@@ -194,9 +194,12 @@ if (!failures.length) {
194194 if (!failures.length) {
195195 const paneGone = await page.evaluate(() => {
196196 const head = document.querySelector('.files-pane .detail-block-head');
197- if (!head) return null;
197+ const tabs = document.querySelector('.detail-tabs');
198+ if (!head || !tabs) return null;
199+ // The pane is the tab body itself, rim included, so the body is no
200+ // longer "outside" — the tab strip is.
198201 head.dispatchEvent(new DragEvent('dragleave', {
199- bubbles: true, cancelable: true, relatedTarget: document.body,
202+ bubbles: true, cancelable: true, relatedTarget: tabs,
200203 }));
201204 const box = document.querySelector('.file-upload-box');
202205 return box ? box.classList.contains('file-upload-over') : null;
@@ -232,6 +235,58 @@ if (!failures.length) {
232235 }
233236 }
234237
238+// Full pane, not its upper half: the section must own the whole tab
239+// region, so the bottom of `.detail-body` — empty space below the list —
240+// is inside the section and catches the hand. elementFromPoint at the
241+// body's bottom edge names the node a real drop there would hit; a pane
242+// that stops at its content leaves the body's own box to answer.
243+if (!failures.length) {
244+ const bottom = await page.evaluate(() => {
245+ const body = document.querySelector('.detail-body');
246+ if (!body) return null;
247+ const r = body.getBoundingClientRect();
248+ const el = document.elementFromPoint(r.left + r.width / 2, r.bottom - 12);
249+ if (!el) return 'none';
250+ return el.closest('.files-pane') ? 'pane' : el.className || el.tagName;
251+ });
252+ if (bottom !== 'pane') {
253+ failures.push(`the bottom of the pane is not the files pane — elementFromPoint says: ${bottom}`);
254+ }
255+}
256+
257+// And the hand dropped there is a real drop: a fourth file onto the empty
258+// bottom of the pane must ride the same path to a fourth chip.
259+if (!failures.length) {
260+ await page.evaluate(() => {
261+ const body = document.querySelector('.detail-body');
262+ if (!body) return;
263+ const r = body.getBoundingClientRect();
264+ const el = document.elementFromPoint(r.left + r.width / 2, r.bottom - 12);
265+ if (!el) return;
266+ const dt = new DataTransfer();
267+ dt.items.add(new File(['iz four'], 'dropped-d.txt', { type: 'text/plain' }));
268+ el.dispatchEvent(new DragEvent('drop', { bubbles: true, cancelable: true, dataTransfer: dt }));
269+ });
270+ const bottomDropped = await page
271+ .waitForFunction(
272+ () => {
273+ const names = [...document.querySelectorAll('.file-chip-name')]
274+ .map((el) => el.textContent.trim()).sort();
275+ return names.length === 4 && names[3] === 'dropped-d.txt';
276+ },
277+ { timeout: 10000 },
278+ )
279+ .then(() => true)
280+ .catch(() => false);
281+ if (!bottomDropped) {
282+ const chips = await page.evaluate(() =>
283+ [...document.querySelectorAll('.file-chip-name')].map((el) => el.textContent.trim()));
284+ failures.push(`a drop on the pane's bottom never landed as a chip — chips: ${chips.join(' | ')}`);
285+ } else {
286+ await page.screenshot({ path: `${shots}/drop-pane-bottom.png` });
287+ }
288+}
289+
235290 await browser.close();
236291
237292 note(`page errors ${errors.length ? errors.join(' | ') : 'none'}`);