Skip to content

fix: dispatch notification click events - #2558

Open
sedatyildiznet wants to merge 1 commit into
ferdium:developfrom
sedatyildiznet:fix/notification-click-events
Open

sedatyildiznet wants to merge 1 commit into
ferdium:developfrom
sedatyildiznet:fix/notification-click-events

Conversation

@sedatyildiznet

@sedatyildiznet sedatyildiznet commented Sep 13, 2026 •

Copy link
Copy Markdown

Pre-flight Checklist

Description of Change

This change makes Ferdium's wrapped Web Notification behave like an EventTarget when a desktop notification is clicked.

  • Dispatches a real click event
  • Supports both onclick and addEventListener('click', ...)
  • Preserves the correct handler this value and event target
  • Keeps common Notification properties, including data, available to click handlers
  • Adds regression tests for notification forwarding and click handling

Motivation and Context

The current wrapper calls onclick without an event or the correct handler context. It also copies the native Notification prototype without initializing EventTarget state. As a result, services using addEventListener or reading event.target.data cannot reliably navigate to the message or channel that produced the notification.

This improves notification context navigation and is related to #263.

Checklist

  • My pull request is properly named
  • The changes respect the code style of the project (pnpm prepare-code)
  • pnpm test passes
  • I tested/previewed my changes locally

Release Notes

Improve navigation from desktop notifications by dispatching standards-compatible click events.

@SpecialAro

Copy link
Copy Markdown
Member

Hello!

Thank you for rasing this PR.

Can you please follow the PR template, add a description and also check each step on the Checklist?

Thank you very much!

@sedatyildiznet

Copy link
Copy Markdown
Author

Hello!

Thank you for the feedback. I’ve updated the PR description according to the template and completed the checklist.

Please let me know if anything else is needed.

Thank you!

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.

2 participants