Feat toast notifications#222
Open
Madhavi1108 wants to merge 2 commits into
Open
Conversation
Author
|
Hi @Vikrant0207, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR replaces intrusive browser
alert()dialogs with a modern, reusable toast notification system, providing users with a smoother and more accessible feedback experience across the application.The new implementation introduces a centralized
showToast(message, type)utility, polished styling with light and dark theme support, accessibility improvements, and consistent notification handling for success, error, warning, and informational events.Closes #184
Type of Change
Checklist
Changes Made
Reusable Toast Notification Utility
Created a lightweight notification system in
toast.jsexposing a global:The utility:
Dynamically creates toast notifications
Supports multiple notification types
Handles automatic dismissal
Supports manual dismissal
Can be reused throughout the application
Modern Toast Styling
Added
toast.cssto provide a polished notification experience.Features include:
Smooth entrance and exit animations
Top-right positioning
Type-specific border indicators
Modern card-style appearance
Responsive layout
Consistent spacing and typography
Multiple Notification Types
Implemented built-in support for:
Success
Error
Warning
Information
Each notification type includes:
Distinct visual styling
Dedicated iconography
Appropriate color indicators
Accessibility Improvements
Added accessibility enhancements to ensure compatibility with assistive technologies.
Toasts now include:
role="alert"aria-liveattributesNon-blocking announcements
This improves usability for screen reader users while maintaining a seamless experience.
Theme Compatibility
Designed the toast system to integrate with both application themes.
Verified support for:
Light mode
Dark mode
without requiring separate implementations.
Global Integration
Integrated the toast system across the application by linking:
toast.csstoast.jsinto:
Frontend/index.htmlFrontend/Analysis/analysis.htmlmaking notifications available throughout the platform.
Replaced Browser Alerts
Updated existing
alert()calls across the frontend to use the new toast system.Affected scenarios include:
Empty field validation
Backend connectivity failures
Geolocation permission errors
User-facing warnings
General informational messages
This removes blocking browser dialogs in favor of a modern notification experience.
Files Added
Frontend
toast.jstoast.cssFiles Updated
Frontend/index.htmlFrontend/Analysis/analysis.htmlFrontend/script.jsFrontend/Analysis/analysis.jsUser Experience Improvements
Notifications
Users now experience:
Non-blocking feedback
Smooth animated notifications
Consistent messaging across the platform
Automatic dismissal after display
Optional manual dismissal
Accessibility
Improved accessibility through:
ARIA-compliant alerts
Screen reader compatibility
Better interaction without interrupting workflows
Visual Consistency
The application now provides a unified notification system instead of inconsistent browser-native dialogs.
How Has This Been Tested?
Toast Rendering
Verified:
Success notifications display correctly
Error notifications display correctly
Warning notifications display correctly
Information notifications display correctly
Animation Testing
Verified:
Smooth appearance animation
Automatic dismissal after 4 seconds
Manual dismissal behavior
Accessibility Validation
Verified:
role="alert"is appliedaria-liveattributes announce notifications properlyScreen reader compatibility is maintained
Theme Validation
Verified:
Toast styling renders correctly in light mode
Toast styling renders correctly in dark mode
Alert Replacement Testing
Verified replacement of browser
alert()calls for:Empty input validation
Backend connection failures
Geolocation permission errors
General application warnings
Global Availability
Verified:
Toast system loads correctly on
index.htmlToast system loads correctly on
analysis.htmlshowToast()is available throughout the applicationAcceptance Criteria
Browser
alert()dialogs are replaced with toast notificationsNotifications support Success, Error, Warning, and Information types
Toasts display with modern styling and animations
Notifications automatically dismiss after a fixed duration
Users can manually dismiss notifications
Accessibility requirements (
role="alert"andaria-live) are implementedToasts support both light and dark themes
Notification system is reusable across the application
Existing validation and error flows now use
showToast()Technical Notes
The toast system is implemented as a lightweight standalone utility centered around the reusable
showToast(message, type)API, allowing future components to display notifications without duplicating logic.Styling is isolated within
toast.css, ensuring consistent appearance across the platform while supporting both light and dark themes.By replacing native browser
alert()dialogs with non-blocking notifications, the application now delivers a significantly smoother and more modern user experience while improving accessibility and maintainability.The architecture is designed for future extensibility and can easily support additional features such as persistent notifications, action buttons, notification queues, or custom positioning without major structural changes.