0.122.10: due-date time picker focus fix + Copy text above Clone

This commit is contained in:
Human 2026-06-25 09:05:10 -07:00
parent 434896fd66
commit e56ec00bea
6 changed files with 34 additions and 8 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"id": "stashpad",
"name": "Stashpad",
"version": "0.122.9",
"version": "0.122.10",
"minAppVersion": "1.13.0",
"description": "A chat-style, nested-notes workspace: rapid capture, outliner navigation, fast search, tasks, and per-folder templates, with one-click Open Knowledge Format (OKF) export for LLMs and agents.",
"author": "Human",

View file

@ -1,6 +1,6 @@
{
"name": "stashpad-obsidian",
"version": "0.122.9",
"version": "0.122.10",
"private": true,
"scripts": {
"dev": "node esbuild.config.mjs",

13
release-notes/0.122.10.md Normal file
View file

@ -0,0 +1,13 @@
# 0.122.10
A focused follow-up to 0.122.9.
- **Due-date / assign modal — time picker focus.** Clicking the clock to open the
numpad time picker no longer drops the cursor into the date field. The picker
popover is now hosted inside the modal (it previously lived in the document
body, outside the modal's focusable area, so the modal pulled focus back to its
first field), and the hour field is focused once the modal's own focus handling
settles. The search When-builder's time picker was already correct and is
unchanged.
- **Note context menu order.** "Copy text" now sits above "Clone (duplicate /
copy)".

View file

@ -1756,7 +1756,16 @@ export class DueDatePickerModal extends Modal {
const period: "am" | "pm" = h24 >= 12 ? "pm" : "am";
const seedH = h24 === 0 ? 12 : (h24 > 12 ? h24 - 12 : h24);
const pop = doc.body.createDiv({ cls: "stashpad-when-popover stashpad-due-time-pop" });
// 0.122.10: host the popover INSIDE the modal element, not doc.body. When
// it lived in body (outside the modal's focusable subtree) the modal's
// focus management pulled focus back to the first field (the date input)
// the instant the time picker focused its hour field — so clicking the
// clock landed you in the date box. Keeping it inside modalEl mirrors the
// search When-builder (whose picker is hosted in its own focusable region)
// and lets the hour field keep focus. position:fixed still anchors to the
// viewport. Falls back to doc.body if modalEl is somehow unavailable.
const host = (this.modalEl as HTMLElement | undefined) ?? doc.body;
const pop = host.createDiv({ cls: "stashpad-when-popover stashpad-due-time-pop" });
// Above the modal (Obsidian modals sit ~var(--layer-modal)).
pop.setCssStyles({ position: "fixed", zIndex: "9999" });
@ -1793,6 +1802,9 @@ export class DueDatePickerModal extends Modal {
setTimeout(() => {
doc.addEventListener("mousedown", outside, true);
doc.addEventListener("keydown", onKey, true);
// 0.122.10: re-assert focus on the hour field after the modal's own
// focus handling has settled, so the picker opens ready for numeric entry.
pop.querySelector<HTMLInputElement>(".stashpad-when-time-field")?.focus();
}, 0);
}

View file

@ -11219,14 +11219,15 @@ export class StashpadView extends ItemView {
menu.addItem((it: any) => it.setTitle("Focus in Stashpad").setIcon("arrow-right").onClick(() => this.navigateTo(node.id)));
menu.addSeparator();
menu.addItem((it: any) => it.setTitle("Split note…").setIcon("split").onClick(() => void this.cmdSplit(node)));
// 0.122.2 (#9): copy the note's text. `focusClicked` (defined below)
// normalises selection to the right-clicked row.
// 0.122.10: ordered above Clone so the plain "Copy text" reads first.
menu.addItem((it: any) => it.setTitle("Copy text").setIcon("copy").onClick(() => { focusClicked(); void this.cmdCopy(); }));
menu.addItem((it: any) => it.setTitle("Clone (duplicate / copy)").setIcon("files").onClick(() => {
// Operate on the right-clicked row even if it isn't selected.
if (!this.selection.has(node.id)) { this.selection.clear(); this.selection.add(node.id); this.lastSelected = node.id; }
void this.cmdClone();
}));
// 0.122.2 (#9): copy the note's text, or cut the whole note (for paste/move).
// `focusClicked` (defined below) normalises selection to the right-clicked row.
menu.addItem((it: any) => it.setTitle("Copy text").setIcon("copy").onClick(() => { focusClicked(); void this.cmdCopy(); }));
// 0.122.7: "Cut note" pulled from the menu for now — cut/paste has known bugs
// and cutting a parent/home note from the context menu is too easy a footgun.
// Still available via the cutNotes hotkey. (See ui-polish todos.)