Repository navigation
feat(blocks): add row actions to tables and a menu element - #3483
Conversation
🦋 Changeset detectedLatest commit: d744d83 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
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 |
Scope checkThis PR changes 504 lines across 16 files. Large PRs are harder to review and more likely to be closed without review. If this scope is intentional, no action needed. A maintainer will review it. If not, please consider splitting this into smaller PRs. See CONTRIBUTING.md for contribution guidelines. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
There was a problem hiding this comment.
The code change is a focused, well-shaped addition: table columns can now render a button, link, or menu element per row, and a new menu element dispatches block_action with the chosen item value. The implementation follows existing conventions in @emdash-cms/blocks: validation reuses validateElement/policy, rendering reuses renderElement, the type hierarchy keeps menu out of form fields, tests cover element cells and validation edge cases, and the docs/changeset are consistent.
Static review did not find logic bugs, regressions, security issues, or AGENTS.md convention violations in the code itself (no new queries, no SQL interpolation, no leaked internals, no untranslated admin strings, RTL-safe text-end, no comment noise, changeset is useful).
The only real concern is process/approach: AGENTS.md requires a prior maintainer-approved Discussion for a feature, and this PR explicitly does not have one. The author acknowledges this and is presenting the PR as a concrete proposal. That is the maintainer's call to make before merge, not a code defect, but it is the right problem to flag first. If the maintainers approve the direction, the implementation appears solid and could land as-is.
(Automated/static review only — I did not run the test suite, linter, or build.)
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
What does this PR do?
Adds row actions to Block Kit tables, plus a new
menuelement.Sandboxed plugins often list entries that each need an action, such as "translate this post", "open", or "retry". Today a table can only show text, badges, dates and relative times, so a plugin has to put its actions in a separate
actionsblock. Those actions are cut off from their rows, and every choice needs its own button.format: "element"table columns. Each row can hold abutton,link, ormenuunder that column's key. An empty cell renders nothing. Validation accepts only those three element types in element cells and applies the same response policy used elsewhere, so a link'splugin-pagetarget must still be one of the plugin's declared pages. Element columns are end-aligned.menuelement. A button that opens a KumoDropdownMenu. Choosing an item dispatches{ type: "block_action", action_id, value }with the item'svalue. Menus need at least one item, item values must be unique, andstyleisprimaryorsecondary.actionsblocks, section accessories, empty-state actions and table cells.link, menus are rejected as form fields:menuis part ofActionElementbut notElement.elements.menu(actionId, label, items, { style })builder and an exportedMenuElementtype./componentspage inmarketplace-testgets a row menu, and the registry inventory test now requires a decision for everyActionElementtype.block-kit.mdx) and thecreating-pluginsskill reference cover the new column format and element.Existing tables and elements are unchanged. The other headings in the screenshots are centred; #3480 fixes that separately.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runmessages.pochanges except in translation PRs — a workflow extracts catalogs on merge tomain.Translation: not applicable. Menu, item and column labels come from the plugin's Block Kit JSON, and the admin gets no new strings.
Discussion: there isn't one yet. I'm opening this as a concrete proposal, and I'm happy to move it to an Ideas Discussion or close it if the shape isn't right.
Targeted tests run:
packages/blocks(164),plugin-testregistry inventory (9), admin (2701), core plugins and editor extension (884). The docs build also passes.AI-generated code disclosure
Screenshots / test output
The table has an Actions element column. Rows that still need translations have a "Translate" menu, and a complete row has an "Open" link:
With the menu open, choosing an item dispatches a
block_actionwith that item's value: