[Component Change Request] Notification Bar close improvements
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 298
- Forks
- 83
- Avg merge
- 16h 48m
- Merged PRs (30d)
- 1
Description
Please describe the use case(s) for this component
Showing an in page notification bar for a pre-determined length of time when a user clicks on a button, or performs an action.
Please describe the change you wish to see
We have a JS APi for the notification bar, but it doesn't yet support two features I think would be useful:
- A public function to close the notification e.g
Mzp.Notification.Close(). - An optional parameter to automatically close a notification after a pre-determined length of time e.g.
autoClose: 3000
Please describe why these changes need to be made
Right now to do the above two actions you need workarounds and boilerplate code e.g.
showTimeout = setTimeout(function() {
var button = document.querySelector('.mzp-c-notification-bar-button');
if (button) {
button.click();
}
}, 3000);
Please provide any designs or prototypes of the proposed changes
N/A
Please describe where this component is currently in use
Many pages on mozorg but not many use the JS API. This particular use case would have been handy for the Unfck landing page.
Please describe what this component should do in the following conditions
- When set in front of a dark background
N/A
- When set in front of a light background
N/A
- When viewed in a mobile/responsive viewport
N/A
Is the development of this component a blocking dependency for other work? Please explain if so
No, a nice to have
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the notification bar's JavaScript API and reading how notifications are currently shown and closed. Define the public close function and the optional auto-close interval from the requested examples, then verify that both behaviors work without the current button-click workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100