Skip to content

Improve Contact Form Validation and Accessibility#852

Merged
Akashshelke07 merged 2 commits into
InnoWebLabs:mainfrom
adityashirsatrao007:main
Oct 4, 2025
Merged

Improve Contact Form Validation and Accessibility#852
Akashshelke07 merged 2 commits into
InnoWebLabs:mainfrom
adityashirsatrao007:main

Conversation

@adityashirsatrao007
Copy link
Copy Markdown
Contributor

Description

Enhanced the contact form with comprehensive client-side validation and improved accessibility features. This update provides users with immediate, helpful feedback when filling out the form, making it more user-friendly and reducing submission errors.

Related Issues

This enhancement improves the overall user experience of the contact form, addressing potential usability issues where users might submit invalid data without knowing what went wrong.

Changes Made

  • Name Field Validation: Added pattern matching to ensure names contain only valid characters (letters, spaces, hyphens, and apostrophes). Minimum length of 3 characters enforced.
  • Email Validation: Implemented robust email format validation using regex patterns
  • Message Validation: Added character limits (10-500) with clear feedback to users
  • Real-time Feedback: Validation triggers on blur and updates as users type to fix errors
  • Visual Error Indicators: Red borders and background highlighting for invalid fields
  • Accessible Error Messages: Proper ARIA attributes (aria-invalid, aria-describedby) for screen reader support
  • Form Accessibility: Added proper id/label associations, autocomplete attributes, and semantic HTML structure
  • Dark Mode Support: Error states now work properly in both light and dark themes with appropriate color contrast
  • Code Quality: Removed inline styles from back-to-top button, moved to external CSS following best practices

Checklist

  • I have read the project's contributing guidelines
  • My code follows the project's coding style and conventions
  • I have performed a thorough self-review of my own code
  • I have added comments to my code, especially in complex or non-obvious sections
  • My changes introduce no new warnings or errors during compilation/runtime
  • The code maintains consistency with existing project patterns
  • All validation functions are well-documented and maintainable

Testing

Tested the form with various inputs:

  • Valid names, emails, and messages submit successfully
  • Invalid inputs (short names, malformed emails, empty messages) show appropriate error messages
  • Error messages clear when users correct their input
  • Form works correctly in both light and dark modes
  • Accessibility features verified (keyboard navigation, screen reader announcements)

This contribution maintains the existing design aesthetic while significantly improving the user experience and code quality of the contact form.

Added comprehensive client-side validation with real-time feedback for the contact form. Users now get immediate, helpful error messages when they enter invalid data, making the form much easier to use.

Changes made:
- Added regex-based validation for name field (letters, spaces, hyphens, apostrophes only)
- Enhanced email validation with proper regex pattern
- Message length validation with min 10 and max 500 characters
- Real-time error display as users type or leave fields
- Visual error indicators with red borders and background highlighting
- Accessible error messages with aria-invalid and aria-describedby attributes
- Improved form accessibility with proper labels, autocomplete, and required attributes
- Dark mode support for error states with appropriate color contrast
- Replaced inline styles with proper CSS classes for back-to-top button
- Better semantic HTML structure with form field grouping
…alidation

Improve Contact Form Validation and Accessibility
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 3, 2025

👋 Thank you for opening this Pull Request!

Your contribution is much appreciated. Our team will review it shortly.

🔎 In the meantime, please:

  • Ensure all file changes are correct.
  • Verify that your commits are clean and meaningful.
  • Address any pending review comments if applicable.

We look forward to collaborating with you. 🚀

@Akashshelke07 Akashshelke07 added level 2 medium gssoc25 GirlScript Summer of Code 2025 labels Oct 4, 2025
@Akashshelke07 Akashshelke07 merged commit 99e0229 into InnoWebLabs:main Oct 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc25 GirlScript Summer of Code 2025 level 2 medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants