Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
This review can't approve yet: an engineering owner has to decide on the CommentPin record changes, and two fixes are needed.
Owner decision needed. The pull request writes new requirements into the draft CommentPin record (FR5's selection source and "never removes or hides itself", FR12's activation order, AR2's deselection request and AR7's host focus order), and it makes a pin rendered without isSelected select itself on a mouse click, a desktop behavior change that also needs an explicit owner decision. An engineering owner records the decision by commenting /approve-spec with the full head SHA, which the author may do if they are an engineering owner.
Required fixes:
packages/lab/src/CommentPin/CommentPin.doc.mjs:168usescategory: 'Focus', which the doc type does not allow ('Color contrast' | 'Keyboard' | 'Semantics' | 'Content'), so the Labtypecheckjob fails;'Keyboard'matches the repository's other 2.4.3 rows.- The description says
ElementSizeis "the type every Core component'ssm | md | lguses", but most sized Core components keep their own alias (for exampleDropdownMenuSizeandInputSize), so please reword it to describe Core's sharedsm | md | lgtype fromSizeContext.
Also worth a look: the "Single thread" docs example now toggles off on a second click while its thread stays open, and the "Resolved threads leave the content" example leaves out the focus move that the new accessibility row asks for.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- On main, an unselected resolved pin renders nothing, so a focused pin the host deselects drops focus: verified (base
CommentPin.tsx:464-466). - On main, dimmed pins paint at 0.4 opacity: verified (base
CommentPin.tsx:196-201); the quoted contrast ratios were not measured. - A pin without
isSelectedflips on activation,onSelectedChangeruns afteronClickon click, Enter or Space, and a disabled pin calls neither: verified (CommentPin.tsx:470-486and the new tests). - Participants share the Comments person type with
src, and Comments changes only its type, its one reader and a test fixture: verified (no otheravatarUrlreader remains). sizetakesElementSizewith the same values and default: verified (CommentPin.tsx:392-393).ElementSizeis the type every Core component'ssm | md | lguses: false (most sized Core components export their own alias).- The selection props follow the naming table and CommentThread: verified.
- The theme target no longer reflects
data-dimmedordata-resolved: verified. - Lab is private, so no changeset is owed: verified (
packages/lab/package.json). - Stories, blocks and the record were updated as described: verified.
- New tests cover the listed cases: verified by reading; not run here.
tsc --noEmitfor the Lab package passes: false for the package typecheck (CI fails in its docs step atCommentPin.doc.mjs:168).- Vitest run, eslint/prettier, repository checks, pre-review checklist and Storybook captures: not verified here; CI lint passed and the tests are deferred until review passes.
Files:
apps/storybook/stories/CommentPin.stories.tsx: cleardocs/specs/components/CommentPin/CommentPin.spec.md: owner approval needed; FR1 now reads against FR5/FR12 (non-blocking)packages/lab/blocks/CommentPinInMargin.doc.mjs: clearpackages/lab/blocks/CommentPinInMargin.tsx: clearpackages/lab/blocks/CommentPinShowcase.doc.mjs: clearpackages/lab/blocks/CommentPinShowcase.tsx: clearpackages/lab/src/CommentPin/CommentPin.doc.mjs: typecheck failure at line 168; two example notespackages/lab/src/CommentPin/CommentPin.test.tsx: clearpackages/lab/src/CommentPin/CommentPin.tsx: clearpackages/lab/src/CommentPin/index.ts: clearpackages/lab/src/Comments/CommentParts.tsx: clearpackages/lab/src/Comments/Comments.test.tsx: clearpackages/lab/src/Comments/types.ts: clearpackages/lab/src/index.ts: clear
ceb7ff8 to
c4542db
Compare
There was a problem hiding this comment.
This review can't approve yet: an engineering owner has to decide on the CommentPin record changes, and two sentences in the title and description need rewording (the ElementSize wording from the last round is fixed).
Owner decision needed. The pull request writes new requirements into the draft CommentPin record (FR5's selection source and "never removes or hides itself", FR12's activation order, AR2's deselection request and AR7's host focus order), and it makes a pin rendered without isSelected select itself on a mouse click, a desktop behavior change that also needs an explicit owner decision. An engineering owner records the record decision by commenting /approve-spec with the full head SHA; the author may do so if they are an engineering owner.
Required fixes:
- Miss: The title ends "and nothing dims", but a disabled pin still paints at 0.45 opacity (
CommentPin.tsx:186-191), so please narrow it, for example to "and siblings no longer dim". - Miss: The description's "A pin works with no state of its own" says the opposite of the change, because the pin now keeps its own selection when
isSelectedis left out (CommentPin.tsx:394-397); "A pin works without host state: it keeps its own selection, and activation flips it" would fit.
Still worth a look, non-blocking: the "Single thread" example now toggles off on a second click while its thread stays open, the "Resolved threads leave the content" example leaves out the focus move the new accessibility row asks for, and FR1 still says the pin never mutates selection.
Claims and files checked
Review mode: full; reason: recipe-changed (many rules)
Title: refactor(CommentPin): uncontrolled selection, Comments' person type, and ElementSize; the host hides resolved pins, and nothing dims
Claims:
- Selection works controlled or uncontrolled: verified (
CommentPin.tsx:394-397; the uncontrolled-flip and controlled-request tests pass, run here). - Participants share the Comments person type and read
src: verified (CommentPin.tsx:76,types.tssrc?: string). sizetakesElementSize, the sharedsm | md | lgtype Core'sSizeContextexports: verified (SizeContext.ts:22and Core's./SizeContextexport).- The pin loses
isResolvedandisDimmed, with their style and theme states: verified (CommentPin.tsx:497-504reflects only size, grouped, unread, selected and disabled). - Title, "nothing dims": false (a disabled pin still paints at 0.45 opacity,
CommentPin.tsx:186-191). - Title, the host hides resolved pins: verified (the pin has no resolved state; the docs example and best practice tell the host to stop rendering them).
- On main a resolved pin renders nothing once unselected, and a focused one drops focus to the page: the early return is verified (base
CommentPin.tsx:464-466); the focus drop is reported from the author's own run. - On main a dimmed pin paints at 0.4 opacity while it stays operable: verified (base capture, run here); the quoted contrast ratios are reported.
- Now the pin never removes itself: verified (no early return remains; the focused-pin test passes, run here).
- "A pin works with no state of its own": false (the pin keeps its own selection when
isSelectedis left out,CommentPin.tsx:394-397). - Activation flips a pin without
isSelected,onSelectedChangeruns afteronClickon click, Enter or Space, and a disabled pin calls neither: verified (CommentPin.tsx:470-496; the click, keyboard and disabled tests pass, run here). - One person object feeds both components, and both now say
src: verified. - The selection props follow the naming table and CommentThread's
isSelectedandonSelectedChange: verified (the conventions table'sdefaultIs<Name>;CommentThread.tsx:57-59). - Every delta maps to one of the stated problems: verified (no tag-along found).
- Comments changes only the
avatarUrlrename, in its type, its one reader and a test fixture: verified (a whole-tree search foravatarUrlat the head finds only unrelated CLI export docs; at the base its only reader wasCommentParts.tsx:618). CommentPinParticipantandCommentPinSizeare no longer exported: verified (packages/lab/src/index.ts:50,CommentPin/index.ts:13).- The theme target no longer reflects dimmed or resolved: verified, and no theme selects on either state.
- Lab is private and unreleased, so no Changeset is owed: verified (
packages/lab/package.jsonis private). - The owners decided these changes when they voted to graduate the pin: unverified (no committed record or quoted decision).
- The cited current architecture claims say what the description says: verified against the current records.
- The CommentPin record is a draft that needs a spec owner's approval: verified.
- The docs add the new props, the theme states, a resolved-threads example, and a focus row and best practice: verified (
CommentPin.doc.mjs:101-119, 143, 167-171, 210, 287-301). - The story and blocks select through
onSelectedChange, the state matrix drops the dimmed and resolved rows, and the margin block keeps its own selection: verified (code and Storybook captures, run here). - Every dimmed and resolved clause is gone from the record: verified (searched the head record; the remaining hits are the host's resolved state, value resolution and AR7).
- Every other state-matrix row renders as before: verified (base and head captures, run here).
- The before and after screenshots and the main-branch focus run: reported.
- The new focus test covers the same path on this branch: verified (present and passing, run here).
- OQ2 and OQ3 stay open, and the pin ignores
kindand draws a circle: verified. - 136 tests pass: verified (run here: 136 passed in 5 files).
- Type check, lint and formatting pass: type check and lint verified (CI's typecheck and lint jobs pass at this head); the repository checks, pre-review checklist and Storybook build are reported.
- Rebased onto the base, then validated against a later main without conflict: the base is verified, and the head also merges cleanly with today's main; the earlier validation is reported.
Files:
apps/storybook/stories/CommentPin.stories.tsx: cleardocs/specs/components/CommentPin/CommentPin.spec.md: owner approval needed for FR5, FR12, AR2 and AR7; FR1 reads against FR5 and FR12 (non-blocking)packages/lab/blocks/CommentPinInMargin.doc.mjs: clearpackages/lab/blocks/CommentPinInMargin.tsx: clearpackages/lab/blocks/CommentPinShowcase.doc.mjs: clearpackages/lab/blocks/CommentPinShowcase.tsx: clearpackages/lab/src/CommentPin/CommentPin.doc.mjs: two example notes (non-blocking)packages/lab/src/CommentPin/CommentPin.test.tsx: clearpackages/lab/src/CommentPin/CommentPin.tsx: new click-to-select default needs an owner decision; the disabled opacity makes the title claim falsepackages/lab/src/CommentPin/index.ts: clearpackages/lab/src/Comments/CommentParts.tsx: clearpackages/lab/src/Comments/Comments.test.tsx: clearpackages/lab/src/Comments/types.ts: clearpackages/lab/src/index.ts: clear
| label="Open annotation from Ada" | ||
| participants={[{id: 'ada', name: 'Ada Lovelace', avatarSrc: '/ada.jpg'}]} | ||
| participants={[{id: 'ada', name: 'Ada Lovelace', src: '/ada.jpg'}]} | ||
| onClick={() => openThread('thread-1')} |
There was a problem hiding this comment.
Non-blocking: this pin passes only onClick, so it now keeps its own selection. A second click turns aria-pressed off and calls openThread again while the thread stays open. Pass isSelected from the open thread, as the grouped examples do, or say that the pin's own state is decorative here.
| { | ||
| label: 'Resolved threads leave the content', | ||
| code: `{threads | ||
| .filter(thread => !thread.isResolved) |
There was a problem hiding this comment.
Non-blocking: this example filters resolved threads but leaves out the focus move that the new "Focus when a pin goes away" row asks for. A host that copies it drops focus to the page when the focused pin's thread resolves. A line that moves focus before the filter removes the pin, or a comment that points to the row, keeps the two in step.
| | FR11 | `size` MUST set the root height and minimum width to `--size-element-sm`, `--size-element-md`, or `--size-element-lg` and draw 22, 24, or 28px participant circles, and the reflected size MUST match. Padding MUST be equal on every side and equal to the inset that centers one participant circle in that height; a grouped marker MUST sit its first AvatarGroup ring inside the start padding, so participant circles keep that inset from the start edge. The trailing total or unread dot MUST add `--spacing-1` of end padding, so neither crowds the edge. | product visual direction | product direction; rendered visual review pending | | ||
| | ID | Candidate invariant | Basis | Draft review state | | ||
| | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------- | | ||
| | FR1 | CommentPin MUST render one button and MUST NOT accept, derive, or mutate anchor coordinates, grouping membership, thread selection, or collision layout. | product ownership boundary | product direction; pending owner approval | |
There was a problem hiding this comment.
Non-blocking: FR1 still says the pin MUST NOT "accept, derive, or mutate ... thread selection", while FR5 and FR12 now let it keep and flip its own selection. Consider "which thread is selected among its siblings" so FR1 and FR5 read together.
|
Reworded the description:
The record changes wait for an engineering owner's |
…and ElementSize; the host hides resolved pins, and nothing dims
CommentPin's API pass before it moves to Core:
- Selection takes `isSelected`, `defaultIsSelected`, and
`onSelectedChange`. Activation by click, Enter, or Space runs `onClick`,
then requests the opposite selection; a pin without `isSelected` also
flips itself. A disabled pin does neither.
- Participants are the Comments family's `CommentUser` records, read as
`{id, name, src}`. `CommentUser.avatarUrl` becomes `src`, Avatar's word,
and `CommentPinParticipant` and its `avatarSrc` go away.
- `size` takes `ElementSize`; `CommentPinSize` goes away. Values, default,
and geometry stay the same.
- `isResolved` and its `resolved` theme state go away: a pin never removes
itself, and the host stops rendering the pins it hides. The docs say where
the host moves focus when it removes a focused pin.
- `isDimmed`, its 0.4 opacity, and its `dimmed` theme state go away.
The draft component record, docs, stories, and blocks follow.
c4542db to
d45a025
Compare
|
Rebased onto Repeated on this head: |
There was a problem hiding this comment.
This review can't approve yet: an engineering owner has to decide on the CommentPin record changes, and two sentences in the title and description need rewording.
- Owner decision: the pull request writes new requirements into the draft CommentPin record (FR5's selection source and "never removes or hides itself", FR12's activation order, AR2's deselection request and AR7's host focus move); an engineering owner records the decision by commenting
/approve-spec d45a0254251e1d261aee482819c47fa6711ef5faon this pull request, and the author may do so only if they are an engineering owner. - Owner decision: a pin rendered without
isSelectednow selects itself (aria-pressedand the 2px outline) on a mouse click, a change to what a click does on a default pin that needs an explicit owner decision. - Title: "nothing dims" is not true, because a disabled pin still paints at opacity 0.45 (
CommentPin.tsx:186-191); say that pins no longer dim their siblings, or thatisDimmedis removed. - Description: "A pin works with no state of its own" is not true, because a pin without
isSelectedkeeps its own selection (CommentPin.tsx:394-397); say it works without host state and keeps its own selection.
The three earlier non-blocking notes on the docs examples and FR1's wording still apply. The CommentPin and Comments tests (136) pass when reproduced locally, and CI's typecheck and lint pass on this head.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Title, selection works uncontrolled: verified (
CommentPin.tsx:392-397; test "flips its own selection when isSelected is left out"). - Title, participants use the Comments person type: verified (
CommentPin.tsx:76). - Title,
sizeusesElementSize: verified (CommentPin.tsx:82; Core'sSizeContext.ts:22). - Title, the host hides resolved pins: verified (no self-removal remains; the docs' example and focus row say the host does it).
- Title, nothing dims: false (a disabled pin paints at opacity 0.45,
CommentPin.tsx:186-191). - The pin never removes itself: verified (no early return; test "keeps a focused pin mounted and focused when activation clears its selection").
- On main a resolved pin vanished when unselected and focus fell to the page: reported (the base code's early return confirms the mechanism).
- The dimmed state's 0.4 opacity and its contrast figures: reported (the 0.4 opacity reproduced in the base Storybook capture).
- The dimmed prop and its style are gone: verified (
CommentPin.tsxand the head capture). - A pin works with no state of its own: false (the pin keeps its own selection,
CommentPin.tsx:394-397). - One person record feeds both families, and the size type is the one Core's size context exports: verified (
CommentPin.tsx:54,:76;SizeContext.ts:22). - The new selection trio follows the naming table and CommentThread: verified (API conventions'
defaultIs<Name>row;CommentThread.tsx:57-59). - Both families now say
srcon one type: verified (types.ts:63;CommentParts.tsx:618). - Comments changes only its type, its one reader and a test fixture: verified (repository search; the base's only reader was
CommentParts.tsx:618). - The public delta table (props added, changed and removed, defaults,
onSelectedChangeafteronClick, never on a disabled pin): verified (CommentPin.tsx:471-486; tests "requests a change but keeps a controlled selection until the host passes it" and "neither calls its handlers nor flips its selection when disabled"). - The theme target no longer reflects the dimmed and resolved states: verified (
CommentPin.tsx:497-503; head capture). - Lab is private, so no Changeset or codemod is owed: verified (Lab's package is private and canary-only; the release record exempts private-package-only changes).
- The cited architecture claims (existing vocabulary, one prop per concept, handler composition, no visual-only booleans, one API per job, the shared size axis, explicit cascade participation): verified against the current records.
- The CommentPin record is a draft that needs an owner's approval: verified (draft, no approver).
- The listed code, docs, story, block and record edits, including every dimmed and resolved record clause removed: verified (record search finds no dimmed clause; the remaining "resolved" words are count normalisation or host-owned statements).
- Screenshots and the base focus-loss check: reported.
- The new focus test covers the same path: verified (passes, reproduced locally).
- The two open questions, and the pin ignoring
kind: verified (record OQ2 and OQ3; the pin's Avatar takes no shape). - Writing-rubric self-check: reported.
- Test, typecheck, lint, repository-check and Storybook-build results: reported; the 136 tests reproduced locally, and CI's typecheck and lint pass on this head.
- The focus row uses the Keyboard category because the docs type has no Focus category: verified (doc type union).
- The rebase left this pull request's own diff unchanged: verified (identical patch ID).
Files:
docs/specs/components/CommentPin/CommentPin.spec.md: draft FR5, FR12, AR2 and AR7 wait on an owner; FR1 wording (non-blocking).packages/lab/src/CommentPin/CommentPin.tsx: clear; its disabled style is what makes the title's "nothing dims" false.packages/lab/src/CommentPin/CommentPin.doc.mjs: two examples drift from the contract (non-blocking).packages/lab/src/CommentPin/CommentPin.test.tsx: clear.packages/lab/src/CommentPin/index.ts: clear.packages/lab/src/index.ts: clear.packages/lab/src/Comments/types.ts: clear.packages/lab/src/Comments/CommentParts.tsx: clear.packages/lab/src/Comments/Comments.test.tsx: clear.apps/storybook/stories/CommentPin.stories.tsx: clear.packages/lab/blocks/CommentPinShowcase.tsx: clear.packages/lab/blocks/CommentPinShowcase.doc.mjs: clear.packages/lab/blocks/CommentPinInMargin.tsx: clear.packages/lab/blocks/CommentPinInMargin.doc.mjs: clear.
…ption No file changes. The pull request title now says that isDimmed is removed, and the description says that a pin keeps its own selection without host state.
|
Both sentences are reworded:
The description's Authority section now lists both owner decisions for the spec owner's The new head adds one empty commit so this review runs again; its tree is the same as the last head, which passed 136 tests, the Lab typecheck, |
There was a problem hiding this comment.
This review can't approve yet: an engineering owner has to decide on the CommentPin record changes and on the new click-to-select default. The title and description sentences flagged last time now match the code, and no code changes are needed.
- Owner decision (record): the pull request writes new requirements into the draft CommentPin record (FR5's selection source and "never removes or hides itself", FR12's activation order, AR2's deselection request and AR7's host focus move); an engineering owner records the decision by commenting
/approve-spec 2ce97d4fe1ba7931b8e7e7cea81ce33a828d0f94on this pull request, and the author may do so only if they are an engineering owner. - Owner decision (desktop behavior): a pin rendered without
isSelectednow selects itself (aria-pressedand the 2px outline) on a mouse click, a change to what a click does on a default pin that needs an explicit owner decision beyond the spec approval.
The three earlier non-blocking notes on the "Single thread" and resolved-threads docs examples and on FR1's wording still apply. The CommentPin and Comments tests (136) pass when reproduced locally, and CI's typecheck and lint pass on this head.
Claims and files checked
Review mode: full; reason: author-not-engowner
Claims:
- Title, selection works uncontrolled: verified (
CommentPin.tsx:394-397; test "flips its own selection when isSelected is left out"). - Title, participants use the Comments person type: verified (
CommentPin.tsxparticipants: readonly [CommentUser, ...CommentUser[]]). - Title,
sizeusesElementSize: verified (CommentPin.tsx:35; Core'sSizeContext.ts:22). - Title, the host hides resolved pins: verified (no self-removal remains; the docs' example and focus row say the host does it).
- Title,
isDimmedis removed: verified (prop, style and theme state gone; a repository search finds no remaining use). - On main a resolved pin vanished when unselected and focus fell to the page: reported (the base code's early return confirms the mechanism).
- The pin never removes itself: verified (its one return always renders the button,
CommentPin.tsx:568-573; test "keeps a focused pin mounted and focused when activation clears its selection"). - The dimmed state's 0.4 opacity: verified (base style, and a browser probe of the base placement story); its contrast figures: reported.
- A pin works without host state, keeps its own selection, and activation flips it: verified (
CommentPin.tsx:394-397,:480-485; tests for click, Enter and Space). - A host keeps one pin selected through
isSelectedandonSelectedChange: verified (story and showcase hosts; docs examples). - One person record feeds both families, and the size type is the one Core's size context exports: verified.
- The selection trio follows the naming table and CommentThread: verified (API conventions'
defaultIs<Name>row;CommentThread.tsx:57-59). - Both families now say
srcon one type: verified (types.ts:63;CommentParts.tsx:618). - Comments changes only its type, its one reader and a test fixture: verified (repository search on the base and head).
- The public delta table (props added, changed and removed, defaults,
onSelectedChangeafteronClickon click, Enter or Space, never on a disabled pin): verified (CommentPin.tsx:471-485is the only call site; tests "requests a change but keeps a controlled selection until the host passes it", "flips its selection from Enter and Space" and "neither calls its handlers nor flips its selection when disabled"). - The theme target no longer reflects the dimmed and resolved states: verified (
CommentPin.tsx:497-504; docs theming targets). - Lab is private, so no Changeset or codemod is owed: verified (Lab's package is private and canary-only; the release record exempts private-package-only changes).
- The cited architecture claims (existing vocabulary, one prop per concept, handler composition, no visual-only booleans, one API per job, the shared size axis, explicit cascade participation): verified against the current records.
- The owners' graduation decisions: unverified (not in any committed record); they are what the owner decisions above settle.
- The CommentPin record is a draft that needs an owner's approval: verified (draft, no approver).
- An owner's spec approval also decides the desktop click change: unverified (the desktop default needs its own explicit owner decision).
- The listed code, docs, story, block and record edits, including every dimmed and resolved record clause removed: verified (no dimmed clause remains; the remaining "resolved" words are count normalisation or host-owned statements).
- Screenshots and the base focus-loss check: reported; the opacity change reproduced in a browser here.
- The new focus test covers the same path: verified (passes, reproduced locally).
- The two open questions, and the pin ignoring
kind: verified (record OQ2 and OQ3; the pin's Avatar takes no shape). - Writing-rubric self-check: reported.
- Public text carries no internal context: verified (added lines, title, body, branch and commit messages checked).
- Test, typecheck, lint, repository-check and Storybook-build results: reported; the 136 tests reproduced locally, and CI's typecheck and lint pass on this head.
- The focus row uses the Keyboard category because the docs type has no Focus category: verified (doc type union).
- The rebase left this pull request's own diff unchanged: verified (identical patch ID).
- The new head is an empty commit with the same tree as the last one: verified.
Files:
docs/specs/components/CommentPin/CommentPin.spec.md: draft FR5, FR12, AR2 and AR7 wait on an owner; FR1 wording (non-blocking).packages/lab/src/CommentPin/CommentPin.tsx: the click-to-select default waits on an owner decision; otherwise clear.packages/lab/src/CommentPin/CommentPin.doc.mjs: two examples drift from the contract (non-blocking).packages/lab/src/CommentPin/CommentPin.test.tsx: clear.packages/lab/src/CommentPin/index.ts: clear.packages/lab/src/index.ts: clear.packages/lab/src/Comments/types.ts: clear.packages/lab/src/Comments/CommentParts.tsx: clear.packages/lab/src/Comments/Comments.test.tsx: clear.apps/storybook/stories/CommentPin.stories.tsx: clear.packages/lab/blocks/CommentPinShowcase.tsx: clear.packages/lab/blocks/CommentPinShowcase.doc.mjs: clear.packages/lab/blocks/CommentPinInMargin.tsx: clear.packages/lab/blocks/CommentPinInMargin.doc.mjs: clear.
Primary intent
CommentPin's API pass before it moves to Core, as its owners decided when they voted to graduate it: selection works controlled or uncontrolled, participants share the Comments family's person type,
sizetakes the system's element-size type, and the pin loses itsisResolvedandisDimmedprops. The pull request adds, removes, and retypes props, so neither the bug-fix nor the feature template fits; the title saysrefactor. It is the first of two: the move to Core stacks on it.User or maintainer impact
isResolvedrenders nothing once it is not selected. A reader who resolves a thread and then presses Enter on its selected pin is left on a removed button, and focus drops to the page body (the Component Audit Rubric's A5 check: focus never drops to the page). Now the pin never removes itself. The host decides which pins render, and the docs say where it moves focus first.isDimmedsetsopacity: 0.4on a pin that stays operable. Its thread count falls to 2.06:1 in dark mode and 2.48:1 in light mode (the rubric's D7 check: operable content keeps its contrast). The prop and its style are gone.isSelectedand updates it fromonSelectedChange. A participant is the sameCommentUserrecord the Comments family takes, so one person object feeds both.sizetakesElementSize, the sharedsm | md | lgtype that Core'sSizeContextexports.Problem and solution fit
isResolvedlet the pin erase itself, but only the host knows where focus should go next. Removing pins is the host's job, so the host owns the focus hand-off too.isDimmedwas a boolean that only swapped visuals, at a contrast no operable control may have. A product that wants dimming styles it itself.aria-pressed. TheisSelected,defaultIsSelected, andonSelectedChangetrio follows the system's naming table and CommentThread's existingisSelectedandonSelectedChange.avatarSrcand Comments saidavatarUrlfor the same Avatarsrc. Both now saysrc, on one type.Every delta maps to one of these points. The Comments family changes only where its person type renames
avatarUrltosrc(types.ts, the one place that reads it, and a test fixture).Before and after:
Public delta:
participantsreadonly [CommentPinParticipant, ...], item{id, name, avatarSrc?}readonly [CommentUser, ...CommentUser[]]; the pin readsid,name, andsrcCommentPinParticipant,CommentPinSizeCommentUser.avatarUrlstring?src?: stringsizeCommentPinSize('sm' | 'md' | 'lg'), default'sm'ElementSize, same values and default; heights and circles unchangedisSelectedfalsedefaultIsSelectedboolean, defaultfalseonSelectedChange(isSelected: boolean) => void; runs afteronClickon a click, Enter, or Space; a disabled pin does not call itisDimmedboolean, opacity 0.4, theme statedimmedisResolvedboolean; an unselected resolved pin returnsnull; theme stateresolvedTheme authors:
astryx-comment-pinno longer reflectsdata-dimmedordata-resolved. Lab is private and unreleased, so no Changeset or codemod is owed.Authority
isResolved(the host stops rendering resolved pins, and the docs say where it moves focus), dropisDimmedwith its 0.4 opacity, takeisSelected+defaultIsSelected+onSelectedChange, share{id, name, src}with Comments, and size on the element-size scale.architecture:public-component-apiDEC-1 (a prop uses the word the system already has: Avatar takessrc), INV3 (a prop never silently suppresses another, asisResolvederased the pin), INV7 (a consumer cancels built-in behavior only where the API promises it, soonClickdoes not cancel the selection request), INV20 (no boolean that only swaps visuals), and INV21 (one API per job: one person type).architecture:component-size-cascadeINV1 (the standard size axis is the sharedsm | md | lg) and INV2 (a component joins the cascade only when its own contract says so; this one does not).defaultIs<Name>.component:CommentPinis a draft record. This pull request amends it to match (below), so it needs a spec owner's/approve-spec. That approval decides two things:isSelectednow selects itself on a mouse click (aria-pressedand the 2px outline).Change and evidence
CommentPin.tsx: the props above. Activation runsonClick, then requests the opposite selection; a pin withoutisSelectedalso takes it. Thedimmedstyle and theopacity: 1that only beat it are gone.CommentPin.doc.mjs(English, Chinese, dense): the new props, the theme states, an example that filters out resolved threads, and an accessibility row and a best practice that say where the host moves focus before it removes a focused pin: the thread's entry in its comments list when one shows, otherwise the next pin in reading order, or the annotated content when no pin is left.onSelectedChange, and the margin block keeps its own selection.component:CommentPinrecord: every dimmed and resolved clause is gone (glance table, compatibility, ownership, concept rows, FR5, ORD4, AR6, DD6, DD9, states, verification map). The size row namesElementSize, FR5 and the ownership section say the pin keeps an uncontrolled selection, the new FR12 states the activation order, AR2 says that activating the selected pin requests deselection, and the new AR7 says the host moves focus before it removes a focused pin.Real Chromium, Storybook's placement story after the margin pin is selected. On main the grouped pin dims to opacity 0.4; on this branch it keeps full contrast:
State matrix: the dimmed and the resolved-selected rows are gone, and every other row renders as before.
Unchanged path, the placement story at rest: before, after. Avatar images were blocked in the capture, so the circles show initials in both builds.
Focus (A5): on main, a throwaway test focused a selected
isResolvedpin and pressed Enter while its host cleared the selection; the pin disconnected anddocument.activeElementwasBODY. The new test "keeps a focused pin mounted and focused when activation clears its selection" covers the same path on this branch.Open, not in this pull request
These need an owner's decision that neither the records nor the graduation decisions settle, so the code keeps today's behavior and the record lists them as open questions:
sizejoin the size cascade (its ownsize, then the nearest SizeProvider, thensm)? The pin only reuses theElementSizetype for now.CommentUserwhosekindisagentwith a square-cornered avatar. The pin ignoreskindand draws a circle.Writing rubric results
docs/specs/components/CommentPin/CommentPin.spec.md:Scope
Components: CommentPin, Comments (person type only)
Testing
pnpm vitest run packages/lab/src/CommentPin packages/lab/src/Comments: 136 passed. New cases cover uncontrolled flips,defaultIsSelected, a controlled pin that requests a change and waits for the host, Enter and Space, a disabled pin that neither calls its handlers nor flips,srcreaching Avatar, and the focused pin that stays mounted and focused when activation clears its selection.tsc --noEmitfor@astryxdesign/labeslintandprettier --checkon the changed files;pnpm check:repo(includespnpm check:knowledge)pnpm review:pre: 0 findingspnpm storybook:build, then the captures above in real ChromiumThe docs' row on where focus goes when a host removes a focused pin uses the
Keyboardaccessibility category, since the docs check accepts noFocuscategory.Rebased onto
mainat 2608fe4, with no change to its own diff (the same patch ID as before the rebase). Repeated on this head:vitest run packages/lab/src/CommentPin packages/lab/src/Comments: 136 passed.tscfor Lab: pass.pnpm review:pre: 0 findings.pnpm check:knowledge: clean.