Skip to content

fix(array): add an edit button to list rows and make the edit dialog dismissable - #1645

Open
bacarndiaye wants to merge 1 commit into
Thinkmill:mainfrom
bacarndiaye:fix/array-edit-button-and-dismiss
Open

bacarndiaye wants to merge 1 commit into
Thinkmill:mainfrom
bacarndiaye:fix/array-edit-button-and-dismiss

Conversation

@bacarndiaye

Copy link
Copy Markdown

Fixes #1644

What

Two small UX fixes for fields.array() (and fields.blocks(), which reuses the same list view):

  1. Edit button on each row. Rows now show a pencil "Edit" button next to "Delete". Clicking the row still opens the dialog. Both icon-only buttons now have an accessible name (aria-label), using the existing edit / delete l10n strings. No new strings.
  2. The "Edit item" dialog can be dismissed with a close button or by clicking outside. @keystar/ui's DialogContainer already supports isDismissable; it was just never enabled here.

Design notes

  • Editing is live: the dialog is bound to the item's preview props, and Done only calls onClose. Dismissing the edit dialog is therefore equivalent to Done (and to pressing Esc, which already worked). Nothing is lost.
  • The Add item dialog is intentionally unchanged. It collects a not-yet-committed item and already has an explicit Cancel button. Making it dismissable by outside click would risk discarding a half-filled item, so isDismissable is only true while modalState.state === 'edit'.
  • Only array/ui.tsx changes. blocks/ui.tsx gets the new row button for free through the shared ArrayFieldListView; its own dialogs are untouched (out of scope here).

Testing

  • pnpm exec prettier --check, pnpm exec eslint on the changed file, and pnpm check:types all pass.
  • Manually, in Chromium against dev-projects/astro (temporarily switched to storage: { kind: 'local' }, not committed), on the "Authors" array of the Posts collection:
    • Add dialog: buttons are Cancel / Add; clicking outside keeps it open; Add closes it and creates the row.
    • Row: buttons are Edit / Delete.
    • Edit via the pencil: dialog shows Done and a Dismiss (X) button. Typing then dismissing keeps the change (row label updates). Clicking outside also closes it.
    • Clicking the row itself still opens the edit dialog.

I have not added automated tests: I could not find existing component tests for the array UI to extend. Happy to add some if you point me to the preferred setup.

Not in this PR

Claude-Session: https://claude.ai/code/session_01QcoLHK1Y8FVsVZ8ayWSBwa

…dismissable

- Each row of an array field now shows an "Edit" icon button next to "Delete".
  Both icon-only buttons get an accessible name.
- The "Edit item" dialog can be closed with a close button or by clicking
  outside. Editing is live ("Done" only closes the dialog), so nothing is lost.
- The "Add item" dialog is unchanged: it keeps its "Cancel" button and is not
  dismissable, so a half-filled item is not discarded by accident.

Fixes Thinkmill#1644

Claude-Session: https://claude.ai/code/session_01QcoLHK1Y8FVsVZ8ayWSBwa
@bacarndiaye
bacarndiaye requested a review from emmatown as a code owner October 19, 2026 23:29
Copilot AI balanced review requested due to automatic review settings October 19, 2026 23:29
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8e3862d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@keystatic/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array field: no visible edit button on rows and no close button in the "Edit item" dialog

2 participants