Open Bug 2024756 Opened 8 months ago Updated 7 months ago

Remove React 16 addEventListener workaround for moz-message-bar dismiss event in toast components

Categories

(Firefox :: New Tab Page, defect, P3)

defect

Tracking

()

People

(Reporter: maxx, Unassigned)

References

(Blocks 1 open bug)

Details

Summary

HideWidgetsToast and ReportContentToast both use useRef + useEffect + addEventListener("message-bar:user-dismissed", ...) on moz-message-bar to handle dismiss actions. This was required in React 16.

The event name message-bar:user-dismissed contains a colon, which prevents using a JSX on* prop directly.

Options to investigate:

  1. Check if moz-message-bar exposes a complementary property or callback (e.g. onDismiss) that React 19 can set as a property
  2. Check if the event name can be changed upstream in the moz-message-bar component to a colon-free name (e.g. message-bar-dismissed), allowing onMessageBarDismissed
  3. If neither is feasible, document this as a known limitation with the current moz-message-bar API

Files

  • content-src/components/Notifications/Toasts/HideWidgetsToast.jsx
  • content-src/components/Notifications/Toasts/ReportContentToast.jsx

I don't think we can do this until React 19 is on release.

Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.