Replace new tab toast notification with moz-message-bar
Categories
(Toolkit :: UI Widgets, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox136 | --- | fixed |
People
(Reporter: tgiles, Assigned: mkennedy)
References
Details
(Whiteboard: [recomp])
Attachments
(1 file)
When creating the the thumbs up/down feature for stories on new tab, a custom toast component was created. This custom toast component is very similar to the moz-message-bar and should be replaced with moz-message-bar for maintainability.
https://searchfox.org/mozilla-central/rev/a2faa4127e3d08e663efb2db42c68afcb06a9b76/browser/components/newtab/content-src/components/Notifications/Notifications.jsx#51-55 is the relevant code in new tab.
Updated•5 months ago
|
Assignee | ||
Updated•2 months ago
|
Comment 1•2 months ago
|
||
I think we'll have a bit of a snag with the event that the moz-message-bar dispatches when the message bar is dismissed. Since it doesn't have an event name that React recognizes we don't have a convenient way of adding the listener using onEventName
directly. There's a @lit/react package that is intended to help with this which would be a nice solution in the future. For now we can likely grab a reference to the moz-message-bar though and manually add the event listener. Looking at the code for @lit/react/createComponent may be helpful, but may be overkill for a one-off. It looks like it uses React.useLayoutEffect()
to get a callback when the element is created/updated
Assignee | ||
Comment 2•2 months ago
|
||
-
Make moz-message-bar reusable component available to New Tab page
-
Replace custom implementation with reusable moz-message-bar component
-
Remove all unnecessary CSS styling of custom implementation
-
Use new Fluent IDs that adhere to the structure of moz-message-bar usage
-
Consolidate Thumbs up and Thumbs down logic into same component to avoid duplicating code unnecessarily
Comment 4•20 days ago
|
||
bugherder |
Description
•