Skip to content

Popup save button stuck in 'saving…' state with progress cursor after successful save #43

@paperhurts

Description

@paperhurts

Reproduce

  1. Click the gitmarks toolbar icon on any page
  2. Click Save this page
  3. Wait for the green "✓ saved" line to appear under the button

Expected

Button reflects the new state — either says "Saved ✓" with a normal cursor, or text changes to "Save again" and re-enables, or the popup auto-closes after a brief delay.

Actual

Button still says "saving…" and is disabled. Because of `button:disabled { cursor: progress; }` in `packages/extension-shared/src/popup.html:26`, hovering it shows a loading cursor. The popup remains open with this confusing dual state ("saving…" button + "✓ saved" status text) until the user clicks elsewhere to dismiss it.

Root cause

`packages/extension-shared/src/popup.ts:107-115` — the success branch only sets the status text:

```ts
if (result.ok) {
status.className = "ok";
status.textContent = "✓ saved";
} else {
status.className = "err";
status.textContent = result.message;
saveBtn.disabled = false;
saveBtn.textContent = "Try again";
}
```

The failure branch correctly re-enables the button and updates its text; the success branch doesn't.

Suggested fix

Pick one (recommended ordering):

  1. Auto-close popup after ~600ms on success. Cleanest UX — the popup served its purpose, get out of the way. Matches how most browser action popups behave after a one-shot action.
  2. Re-enable + relabel to "Saved ✓" and keep the click handler idempotent (saves again on click), or
  3. Re-enable + relabel to "Close" that calls `window.close()`.

I lean (1). If we go with (1), make sure the timeout still gives screen-reader users time to hear the status update.

Scope

Single file edit in `packages/extension-shared/src/popup.ts`. Add a vitest case in `packages/extension-shared/test/` that exercises the popup save flow if not already covered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions