Repository navigation
Conversation
…outside a thread CommentComposer set its own root onClick after the caller's props, so a caller's `onClick` never ran, and it stopped every click from bubbling. The caller's handler now runs first. Only a reply or edit composer inside a thread stops the click, so a press on its empty space does not collapse the thread. Cherry-picked from #13738 (by @ernestt). Co-authored-by: Ernest Tien <ernesttien@meta.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC |
|---|---|---|
| lab/CommentThread | 385.4 kB (+32 B) · 2.4 kB CSS (0) | — |
| lab/Comments | 392.3 kB (+17 B) · 2.5 kB CSS (0) | — |
| lab/CommentComposer | 192.3 kB (+12 B) · 1.9 kB CSS (0) | — |
Package size: no published package changed; no new dependencies.
Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
|
/approve-spec 65947ee |
There was a problem hiding this comment.
Requesting changes for two description fixes; from reading the code, the change itself has no defect.
- The Testing section says this branch is the validated work rebased onto an older
maincommit, but this head sits onmain255 commits later (including changes toCommentActions.tsxandComments.test.tsx), so please name the base the reported checks ran on, or rerun them on this head and say so. - Miss: the description says the composer stops a click in a reply or an edit "where the thread would otherwise close", but no thread is selectable while an edit is open, a post is in flight or an upload runs (
CommentRow.tsx:422-426,:239), so please word that reason, and the matching comment atCommentComposer.tsx:594-595, for the reply composer only, or stop the click only in reply composers.
Neither new test has run yet: CI skipped its test job on this head, and they could not run in this review. Clicks inside the Comments panel's new-comment composer now bubble too, which the User impact section could mention.
Claims and files checked
Review mode: same-head; reason: none
Title (live): fix(CommentComposer): the caller's onClick runs, and a click bubbles outside a thread
Claims:
- Title: the caller's
onClickruns: verified (CommentComposer.tsx:571-577,:593; the test atCommentComposer.test.tsx:109-126asserts it runs once). - Title: a click bubbles outside a thread: verified (
:578,:596-598; of the four composer call sites, the onlycomment-context ones are the standalone composer and the Comments panel's,Comments.tsx:304-307,:428; reply and edit composers render inside a thread surface,CommentRow.tsx:693,:829,:881-895). - On
mainthe composer's ownonClick, set after the spread props, replaced the caller's: verified onmain. - On
mainevery click stopped propagating, so clicks never reached ancestors' click handlers: verified onmain. - Only a composer inside a thread needs the stop, because an empty-space press would toggle the thread: verified for reply composers (
CommentRow.tsx:216-239,useClickableContainer.ts:305-312). - The public component API record says event props reach their element and built-in behavior composes with them: verified (INV5, INV7).
- An audit list flagged this defect on
main: reported; the defect itself is verified onmain. - The fix calls the caller's
onClickfirst and stops only in reply or edit composers: verified. - It stops propagation only inside a thread, where the thread would otherwise close: false for edit composers, and for a reply composer while a post or upload is in flight (
CommentRow.tsx:422-426,:239). - No API, visual or other behavior change: verified; no prop, type, style or markup changes, and the only behavior change is the stated propagation rule, which also covers the Comments panel's new-comment composer.
- Before the change neither handler runs, and after it both run: reported (your runs); consistent with the code; not yet run in CI.
- A press in a thread's reply composer keeps the thread open: verified (the test at
CommentThread.test.tsx:146-166contains the case; the kept stop at:596-598). - The new composer test fails without the fix: reported.
- Event wiring only, with no pixel effect: verified.
- Scope is CommentComposer, one defect, no hidden API, no internal context: verified.
- Vitest,
pnpm review:pre, prettier and eslint pass: reported. - Validated on an older
maincommit: reported. - This branch is that work rebased onto an older
maincommit: false; this head's only parent is amaincommit 255 commits later. - The commit credits the original author and carries #13738's fix onto current
main: verified (co-author line; identical changed lines). - #13740, #13736, #13737 and #13735 are separate Comments pull requests: verified (open, separate changes).
- A replacement of #13739 is stacked on this one: verified (#14158 targets this branch and contains this head).
Files:
packages/lab/src/Comments/CommentComposer.tsx: finding (the comment at:594-595gives the same edit-composer reason).packages/lab/src/Comments/CommentComposer.test.tsx: clear.packages/lab/src/Comments/CommentThread.test.tsx: clear.
|
🤖 (Posted by Cindy's agent.) Thanks. The Testing section no longer says the branch was rebased. It now names what was checked on the original pull request, and the checks rerun at this head on current |
… an edit composer's thread is not selectable
|
🤖 (Posted by Cindy's agent.) Thanks. At |
|
/approve-spec 3db2493 |
There was a problem hiding this comment.
Approved. From reading the code, the click fix has no defect: the new composer test fails against the base and passes on this head (reproduced locally), and CI's unit tests pass both new cases on this head.
- Non-blocking: the first sentence of the comment at
CommentComposer.tsx:594restates theisInThreadcheck below it; the second sentence alone keeps the reason.
Clicks inside the Comments panel's new-comment composer now bubble too, which the User impact section could mention.
Claims and files checked
Review mode: same-head; reason: none
Changed rules (0): none
Title (live): fix(CommentComposer): the caller's onClick runs, and a click bubbles outside a thread
Claims:
- Title: the caller's
onClickruns: verified (CommentComposer.tsx:571-577,:593; the test atCommentComposer.test.tsx:109-126asserts it runs once and passes in CI's unit tests and locally). - Title: a click bubbles outside a thread: verified (
:578,:597-599; the onlycomment-context composers are the standalone one and the Comments panel's,Comments.tsx:304-307,:428; reply and edit composers render inside a thread surface,CommentRow.tsx:693,:829,:881-895). - The change is cherry-picked from the original pull request, whose author the commit credits: verified (co-author line in the commit message).
- On
maina standalone composer's calleronClicknever runs and its clicks never reach ancestors: verified (the composer's ownonClick, set after the spread props, replaced the caller's and stopped every click; reproduced locally against the base). - Only a composer inside a thread needs the stop, so an empty-space press does not toggle the thread: verified (
CommentRow.tsx:216-239,useClickableContainer.ts:305-312). - The public component API record promises that event props reach their element and that built-in behavior composes with them: verified (INV5, INV7).
- An audit list flagged this defect, confirmed on
main: reported; the defect itself is verified onmain. - The composer calls the caller's
onClickfirst and still stops propagation in reply and edit composers, and only there: verified (:593,:578,:597-599). - For a reply composer, the stop keeps an empty-space press from collapsing the thread: verified (the test at
CommentThread.test.tsx:146-166contains the case and passes). - No thread is selectable while an edit is open: verified (
CommentRow.tsx:422-426; the edit state is shared across the panel). - No API, visual or other behavior change: verified; no prop, type, style or markup changes, and the propagation rule also covers the Comments panel's new-comment composer, a composer outside a thread.
- Before the change neither handler runs, and after it both run: verified (locally against the base the new test's caller handler is called 0 times, and the base's unconditional stop blocks the ancestor; on this head both run, in CI's unit tests and locally).
- A press in a thread's reply composer keeps the thread open: verified (the test at
CommentThread.test.tsx:146-166). - The new composer test fails without the fix: verified (reproduced locally against the base).
- Event wiring only, with no pixel effect: verified.
- Scope is CommentComposer, one defect, no hidden API, no internal context: verified.
- This head adds only a corrected source comment on top of the cherry-pick: verified (its commit changes comment lines only).
- On the original pull request, Vitest, the pre-review checklist, prettier and eslint passed: reported.
- At the cherry-pick, install, build,
tsc, prettier, eslint and the changeset check passed, and the two test files ran 41/41 twice: reported; CI's typecheck, lint and build pass on this head, and the two files run 41/41 in CI and locally. - The cherry-pick is clean and sat on the then-current
main: verified (its only parent is this pull request's base). - This pull request replaces the original with the same change on
main: verified (identical changed lines per file, plus the comment fix here). - The replacement of the next pull request is stacked on this one: verified (#14158 targets this branch).
- The four other Comments pull requests are separate changes: verified (open, by the same author, each its own change).
Files:
packages/lab/src/Comments/CommentComposer.tsx: non-blocking suggestion (the comment's first sentence at:594restates the code).packages/lab/src/Comments/CommentComposer.test.tsx: clear.packages/lab/src/Comments/CommentThread.test.tsx: clear.
| // Inside a thread, the click stays in the composer. A press on a | ||
| // reply composer's empty space would otherwise reach the thread and | ||
| // collapse it. |
There was a problem hiding this comment.
Non-blocking: the first sentence restates if (isInThread) event.stopPropagation() below it. The reason alone is enough:
// A press on a reply composer's empty space would otherwise reach the thread
// and collapse it.
Cherry-picked from #13738 by @ernestt, who wrote this fix; the commit credits @ernestt with a
Co-authored-byline. This team pull request carries it onto currentmain.User impact
A product that passes
onClickto a standaloneCommentComposer, for example to track a press or open a panel, never sees it run. Clicks inside a standalone composer also never reach its ancestors, so a host's own click handling around it breaks.Problem and solution fit
onClicknever run? The composer set its own rootonClickafter spreading the caller's props, so its handler replaced the caller's.architecture:public-component-apipromises that a component forwards neutral DOM event props. A silently dropped handler is hard to find.The composer now calls the caller's
onClickfirst. It stops propagation only inside a thread (a reply or an edit), as before. For a reply composer, that keeps a press on its empty space from collapsing the thread. A thread is not selectable while an edit is open.Expected behavior and authority
architecture:public-component-api: the root forwards neutral DOM and event props, and component-owned behavior composes with them instead of replacing them.onClickand stops every click. It was confirmed in the source onmain.Smallest restoration
CommentComposertakes the caller'sonClickout of the root props, calls it from its own handler, and stops propagation only when its context is a reply or an edit. No API, visual, or other behavior change.Evidence
onClickinside a parent withonClick, and presses the composer. Neither handler runs.CommentComposer.test.tsx"calls the caller's onClick and lets the click bubble" (fails without the fix) and the thread case inCommentThread.test.tsx.This is event wiring with no layout or pixel effect, so there are no screenshots.
Scope
Components: CommentComposer
Testing
CommentComposer.tsx: the stop keeps a reply composer's thread from closing), with no code change.vitest run packages/lab/src/Commentspassed, and the new composer case fails without the fix.pnpm review:pre,prettierandeslintwere clean.65947eec(a clean cherry-pick onto currentmain), rerun on Linux:tsc(core, lab),prettier,eslintandcheck:changesetsall pass;Overlap checked: #13740, #13739, #13738, #13736, #13737, #13735 (separate: #13738 is the original by @ernestt, which this team pull request replaces with the same commit on current main; #13739's replacement is stacked on this one; #13740, #13736, #13737 and #13735 are ernestt's other Comments pull requests, each its own change)