Skip to content

Fixed comments UI add details mouse event type#29183

Open
PedroMarianoAlmeida wants to merge 1 commit into
TryGhost:mainfrom
PedroMarianoAlmeida:fix-comments-ui-add-details-mouse-event
Open

Fixed comments UI add details mouse event type#29183
PedroMarianoAlmeida wants to merge 1 commit into
TryGhost:mainfrom
PedroMarianoAlmeida:fix-comments-ui-add-details-mouse-event

Conversation

@PedroMarianoAlmeida

Copy link
Copy Markdown
Contributor

Why I am making it

This is a focused comments-ui typecheck cleanup.

AddDetailsPopup used a DOM Event type for an onMouseDown handler. React passes a React mouse event to that prop, so the handler type was incompatible even though it only needed to stop propagation.

What it does

Inlines the stop-propagation callback on the profile modal onMouseDown prop so TypeScript can infer the correct React mouse event type from JSX.

This keeps the existing runtime behavior while avoiding a named one-line handler that has to be manually typed.

Type error fixed

This removes the apps/comments-ui/src/components/popups/add-details-popup.tsx TS2322 error from the comments-ui tsc --noEmit cleanup:

src/components/popups/add-details-popup.tsx(119,197): error TS2322: Type '(event: Event) => void' is not assignable to type 'MouseEventHandler<HTMLDivElement>'.
  Types of parameters 'event' and 'event' are incompatible.
    Type 'MouseEvent<HTMLDivElement, MouseEvent>' is missing the following properties from type 'Event': cancelBubble, composed, returnValue, srcElement, and 7 more.

Why developers need it

This keeps reducing the comments-ui TypeScript error count and lets developers focus on the remaining real type issues in app.tsx and frame.tsx.

Testing

  • PATH=/Users/pedroalmeida/.nvm/versions/node/v22.13.1/bin:$PATH CI=true pnpm --filter @tryghost/comments-ui exec tsc --noEmit

This still fails on the known remaining comments-ui TypeScript errors, but the add-details-popup.tsx error is gone.

Checklist

  • I've read and followed the Contributor Guide
  • I've explained my change
  • I've written an automated test to prove my change works

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5c3a699c-bcec-47d5-b3d1-bb4770e39d6b

📥 Commits

Reviewing files that changed from the base of the PR and between 65fc69d and 662270f.

📒 Files selected for processing (1)
  • apps/comments-ui/src/components/popups/add-details-popup.tsx

Walkthrough

This change removes a locally defined stopPropagation helper function from the AddDetailsPopup component and replaces its usage with an inline arrow function that calls event.stopPropagation() directly on the modal container's onMouseDown prop. No other logic, including close/submit behavior, is affected. No exported or public entity declarations are altered.

Suggested reviewers: 9larsons

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: fixing the comments UI add-details mouse event type.
Description check ✅ Passed The description clearly matches the TypeScript cleanup and explains the AddDetailsPopup event type fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant