Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Drive: Finder keys — arrows walk the selection, Ctrl-Down opens, Ctrl-Up goes to the parent folder
Yashwanth Kamireddi34390c4843a2
diff --git a/.uiverify/drive-keys.mjs b/.uiverify/drive-keys.mjsnew file mode 100644index 0000000..dce84b8--- /dev/null+++ b/.uiverify/drive-keys.mjs@@ -0,0 +1,30 @@+// Finder's keys in Drive: the arrows walk the selection, Command/Ctrl-Down opens what is+// selected, Command/Ctrl-Up goes back to the folder it is in.+import { engine } from "./engine.mjs";+import { SERVICES, installStub } from "./stub.mjs";+const b = await engine.launch();+const ctx = await b.newContext({ viewport: { width: 1280, height: 800 } });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, driveFixture: true });+const page = await ctx.newPage();+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });+await page.locator(".nav-item", { hasText: "iCloud Drive" }).click();+await page.waitForTimeout(400);+let failures = 0;+const ok = (pass, what) => { console.log(`${pass ? "PASS" : "FAIL"} ${what}`); if (!pass) failures++; };+const chosen = () => page.locator('.drive-row-hit[aria-pressed="true"] .drive-name').allInnerTexts();+const names = await page.locator("button.drive-row-hit .drive-name").allInnerTexts();+await page.locator("button.drive-row-hit").first().click();+await page.keyboard.press("ArrowDown");+ok(JSON.stringify(await chosen()) === JSON.stringify([names[1]]), `Down selects the next row ${JSON.stringify(await chosen())}`);+await page.keyboard.press("ArrowUp");+ok(JSON.stringify(await chosen()) === JSON.stringify([names[0]]), "Up selects the one before");+await page.locator(".drive-row-hit", { hasText: "Downloads" }).click();+await page.keyboard.press("Control+ArrowDown");+await page.waitForTimeout(400);+ok((await page.locator(".crumb").allInnerTexts()).some((t) => t.includes("Downloads")), "Ctrl-Down opens the selected folder");+await page.locator("button.drive-row-hit").first().click();+await page.keyboard.press("Control+ArrowUp");+await page.waitForTimeout(400);+ok(!(await page.locator(".crumb").allInnerTexts()).some((t) => t.includes("Downloads")), "Ctrl-Up goes back to the folder above");+await b.close();+process.exitCode = failures ? 1 : 0;diff --git a/check.sh b/check.shindex 37207b3..e108ffb 100755--- a/check.sh+++ b/check.sh@@ -62,6 +62,7 @@ step "reminder date" node .uiverify/reminders-date.mjsstep "reminder keys" node .uiverify/reminders-keys.mjsstep "contacts order" node .uiverify/contacts-order.mjsstep "contacts lists" node .uiverify/contacts-lists.mjs+step "drive keys" node .uiverify/drive-keys.mjsstep "calendar alerts" node .uiverify/calendar-alerts.mjsstep "calendar repeat" node .uiverify/calendar-repeat.mjsstep "reminder add/done" node .uiverify/reminders-add-done.mjsdiff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex 77aa7b4..7810115 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -900,10 +900,22 @@ export function DriveView() {onClick={() => setSelected(item.drivewsid)}onDoubleClick={() => (container ? enter(item) : void download(item))}onKeyDown={(e) => {- if (e.key === "Enter") {+ const mod = e.ctrlKey || e.metaKey;+ if (e.key === "Enter" || (mod && e.key === "ArrowDown")) {e.preventDefault();if (container) enter(item);else void download(item);+ } else if (mod && e.key === "ArrowUp") {+ // Finder's Command-Up: the folder this one is in.+ e.preventDefault();+ if (trail.length > 1) setTrail((t) => t.slice(0, -1));+ } else if (e.key === "ArrowDown" || e.key === "ArrowUp") {+ // The arrows walk the selection, as in Finder and icloud.com.+ e.preventDefault();+ const rows = [...(e.currentTarget.closest("ul")?.querySelectorAll<HTMLButtonElement>(".drive-row-hit") ?? [])];+ const next = rows[rows.indexOf(e.currentTarget) + (e.key === "ArrowDown" ? 1 : -1)];+ next?.focus();+ next?.click();} else if (e.key === "Delete" || (e.key === "Backspace" && (e.metaKey || e.ctrlKey))) {e.preventDefault();void remove(item);