From 4896365bd5bb41392498dfdc4691eb6ecc056128 Mon Sep 17 00:00:00 2001 From: Tofik Hasanov Date: Wed, 10 Jun 2026 12:51:21 -0400 Subject: [PATCH] feat(framework-editor): multi-line editor for long control descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The controls grid edits descriptions in a single-line input, which is unusable for the 1-2k character descriptions that complex frameworks (SP 800-53, FedRAMP, GovRAMP) need. Reading or editing a full statement 30 chars at a time is impractical. EditableCell gains an opt-in `expandable` mode: a hover ⤢ icon and right-click both open a large centered editor with a ~10-row textarea showing the whole description, with Cancel/Save. Quick single-line edit on a normal click is unchanged. Only the controls Description column opts in; every other cell is byte-for-byte unaffected (the new paths are gated behind the prop). - EditableCell: expandable + expandTitle props; modal mirrors the Tasks description editor's shape (@trycompai/ui Dialog + Textarea), matching app convention. - 10 unit tests (icon/right-click/save/cancel/disabled + quick-edit still works + non-expandable unchanged). Co-Authored-By: Claude Fable 5 --- .../(pages)/controls/ControlsClientPage.tsx | 2 + .../components/table/EditableCell.test.tsx | 123 ++++++++++++++++++ .../app/components/table/EditableCell.tsx | 101 +++++++++++++- 3 files changed, 219 insertions(+), 7 deletions(-) create mode 100644 apps/framework-editor/app/components/table/EditableCell.test.tsx diff --git a/apps/framework-editor/app/(pages)/controls/ControlsClientPage.tsx b/apps/framework-editor/app/(pages)/controls/ControlsClientPage.tsx index 9de5e4cee5..3e5af15073 100644 --- a/apps/framework-editor/app/(pages)/controls/ControlsClientPage.tsx +++ b/apps/framework-editor/app/(pages)/controls/ControlsClientPage.tsx @@ -253,6 +253,8 @@ export function ControlsClientPage({ initialControls, emptyMessage, frameworkId rowId={row.original.id} columnId="description" onUpdate={updateCell} + expandable + expandTitle="Edit Control Description" /> ), }), diff --git a/apps/framework-editor/app/components/table/EditableCell.test.tsx b/apps/framework-editor/app/components/table/EditableCell.test.tsx new file mode 100644 index 0000000000..518d0a1861 --- /dev/null +++ b/apps/framework-editor/app/components/table/EditableCell.test.tsx @@ -0,0 +1,123 @@ +import { fireEvent, render, screen } from '@testing-library/react'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; +import { EditableCell } from './EditableCell'; + +// The ui package ships untranspiled JSX in dist; stub the bits the cell uses. +vi.mock('@trycompai/ui', () => ({ + Button: ({ + children, + variant: _v, + ...props + }: { variant?: string } & React.ComponentProps<'button'>) => ( + + ), + Textarea: (props: React.ComponentProps<'textarea'>) =>