Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Reminders: Ctrl-]/[ indent and outdent, Up/Down walk from reminder to reminder

Yashwanth Kamireddi14f9c0e2b646
diff --git a/.uiverify/reminders-keys.mjs b/.uiverify/reminders-keys.mjs
index 7351701..27acacf 100644
--- a/.uiverify/reminders-keys.mjs
+++ b/.uiverify/reminders-keys.mjs
@@ -28,6 +28,24 @@ ok(!(await row().evaluate((el) => el.classList.contains("is-subtask"))), "Shift-
sent = await page.evaluate(() => window.__edits?.at(-1));
ok(sent && sent.parentGuid === null, `and asks Apple to ${JSON.stringify(sent)}`);
+// Command-] and Command-[ do the same, as the Mac's Format menu has them.
+await page.getByLabel("Rename Pick up the parcel").focus();
+await page.keyboard.press("Control+]");
+await page.waitForTimeout(150);
+ok(await row().evaluate((el) => el.classList.contains("is-subtask")), "Ctrl-] indents it");
+await page.getByLabel("Rename Pick up the parcel").focus();
+await page.keyboard.press("Control+[");
+await page.waitForTimeout(150);
+ok(!(await row().evaluate((el) => el.classList.contains("is-subtask"))), "Ctrl-[ outdents it");
+// Up and Down walk from reminder to reminder.
+const order = await page.locator(".rx-row .rx-title").evaluateAll((els) => els.map((e) => e.getAttribute("aria-label")));
+const at = order.indexOf("Rename Pick up the parcel");
+await page.getByLabel("Rename Pick up the parcel").focus();
+await page.keyboard.press("ArrowDown");
+ok(await page.evaluate((want) => document.activeElement?.getAttribute("aria-label") === want, order[at + 1]), "Down goes to the next reminder");
+await page.keyboard.press("ArrowUp");
+ok(await page.evaluate(() => document.activeElement?.getAttribute("aria-label") === "Rename Pick up the parcel"), "Up comes back");
+
await page.getByLabel("Rename Pick up the parcel").focus();
await page.keyboard.press("Enter");
await page.waitForTimeout(150);
diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsx
index ca3116b..8f91eed 100644
--- a/src/screens/RemindersView.tsx
+++ b/src/screens/RemindersView.tsx
@@ -1162,11 +1162,23 @@ export function RemindersView() {
} else if (e.key === "Escape") {
e.currentTarget.value = reminder.title;
e.currentTarget.blur();
- } else if (e.key === "Tab" && inList) {
+ } else if (inList && (e.key === "Tab" || ((e.ctrlKey || e.metaKey) && (e.key === "]" || e.key === "[")))) {
+ // Tab and Shift-Tab, or Command-] and Command-[ as the Mac's menu has them.
e.preventDefault();
const typed = e.currentTarget.value;
+ const out = e.key === "[" || (e.key === "Tab" && e.shiftKey);
void rename(reminder, typed);
- void (e.shiftKey ? (reminder.parentGuid ? outdent(reminder) : null) : (reminder.parentGuid ? null : indent(reminder)));
+ void (out ? (reminder.parentGuid ? outdent(reminder) : null) : (reminder.parentGuid ? null : indent(reminder)));
+ } else if ((e.key === "ArrowUp" || e.key === "ArrowDown") && !e.shiftKey && !e.altKey) {
+ // Up and Down walk the list, keeping where the caret was.
+ const all = [...document.querySelectorAll<HTMLInputElement>(".rx-row .rx-title")];
+ const next = all[all.indexOf(e.currentTarget) + (e.key === "ArrowDown" ? 1 : -1)];
+ if (next) {
+ e.preventDefault();
+ const caret = e.currentTarget.selectionStart ?? 0;
+ next.focus();
+ next.setSelectionRange(Math.min(caret, next.value.length), Math.min(caret, next.value.length));
+ }
}
}}
/>