Accessibility Test Result: https://drive.google.com/file/d/1cx2TKMzMmE7pl1BwX1cH7LscQkXI2qQ3/view?usp=drivesdk
A fully accessible, responsive contact form built with React, TypeScript, and Tailwind CSS. This application demonstrates best practices for web accessibility (WCAG 2.1 AA compliance) while providing a modern, user-friendly interface.
- Full keyboard navigation - Navigate through all form elements using Tab, Arrow keys, Enter, and Escape
- Screen reader support - Comprehensive ARIA labels, roles, and live regions for assistive technologies
- Focus management - Logical focus order with visible focus indicators
- Error handling - Clear error messages with proper ARIA attributes and screen reader announcements
- Semantic HTML - Proper landmark structure with header, main, and form roles
- High contrast - Colors meet WCAG contrast requirements
- Personal Information Section - First name, last name, email, and phone number fields
- Message Details Section - Subject, message content, contact method preferences, and urgency selection
- Newsletter Subscription - Optional newsletter signup with clear description
- Custom Select Component - Fully accessible dropdown with keyboard navigation
- Radio Group - Contact method selection with keyboard support
- Responsive design - Works seamlessly on desktop, tablet, and mobile devices
- Real-time validation - Immediate feedback as users type
- Toast notifications - Success and error messages using Sonner
- Loading states - Clear indication when form is being submitted
- Form reset - Automatic form clearing after successful submission
- React 18 - Modern React with hooks and functional components
- TypeScript - Full type safety and better developer experience
- Tailwind CSS - Utility-first CSS framework for rapid styling
- Vite - Fast build tool and development server
- Lucide React - Beautiful, customizable icons
- Sonner - Toast notifications
- Shadcn/UI - High-quality, accessible UI components
src/
βββ components/
β βββ ui/ # Shadcn/UI base components
β βββ AccessibleForm.tsx # Main form orchestration component
β βββ ContactMethodRadioGroup.tsx # Radio group for contact preferences
β βββ CustomSelect.tsx # Fully accessible select dropdown
β βββ FormField.tsx # Reusable form input component
β βββ FormHeader.tsx # Form title and description
β βββ MessageDetailsSection.tsx # Message and preferences section
β βββ NewsletterSection.tsx # Newsletter subscription component
β βββ PersonalInfoSection.tsx # Personal information fields
β βββ SubmitSection.tsx # Submit button and help text
βββ pages/
β βββ Index.tsx # Main page component
βββ main.tsx # Application entry point
- Node.js (v18 or higher)
- npm or yarn package manager
- Clone the repository
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser to
http://localhost:5173
npm run build- First Name* - Required text field with autocomplete support
- Last Name* - Required text field with autocomplete support
- Email Address* - Required email field with validation and autocomplete
- Phone Number - Optional tel field with format validation
- Subject* - Required text field for inquiry topic
- Message* - Required textarea with minimum 10 characters
- Contact Method* - Radio group with three options:
- Email - Contact via email address
- Phone - Contact via phone number
- Either - Use whichever method is convenient
- Urgency Level* - Select dropdown with four options:
- Low - Response within 5 business days
- Medium - Response within 2 business days
- High - Response within 24 hours
- Urgent - Response within 4 hours
- Newsletter Subscription - Optional checkbox to receive updates
Fields marked with asterisk () are required*
- Tab/Shift+Tab - Navigate between form fields
- Enter/Space - Activate buttons and checkboxes
- Arrow Keys - Navigate within radio groups and select dropdowns
- Escape - Close open dropdowns
- Home/End - Jump to first/last option in dropdowns
- Proper semantic HTML structure with landmarks
- ARIA labels, descriptions, and live regions
- Form field grouping with fieldsets and legends
- Error announcements and validation feedback
- Status updates during form submission
- High contrast colors meeting WCAG AA standards
- Clear focus indicators on all interactive elements
- Responsive design that works at various zoom levels
- Error states with both color and text indicators
The application uses Tailwind CSS with a custom design system:
- Primary: Blue (500-700) for buttons and focus states
- Secondary: Indigo for gradients and accents
- Success: Green (500-600) for newsletter section
- Error: Red (500-600) for validation messages
- Neutral: Gray scale for text and borders
- Headings: Font weight 600-700 with appropriate sizing
- Body Text: Font weight 400 with good line height
- Labels: Font weight 500 for form field labels
- Keyboard Navigation: Tab through all elements without using a mouse
- Screen Reader: Test with NVDA, JAWS, or VoiceOver
- High Contrast: Verify visibility in high contrast mode
- Zoom: Test at 200% zoom level
- accessibilitychecker.org (I used this: >95% compliance recorded)
- axe-core browser extension
- Lighthouse accessibility audit
- WAVE (Web Accessibility Evaluation Tool)
- Define the field in the
FormDatainterface inAccessibleForm.tsx - Add validation logic in the
validateFormfunction - Create or use existing form field components
- Update the appropriate section component
- Modify Tailwind classes in component files
- Update the color scheme in
tailwind.config.ts - Customize component variants using class-variance-authority
The modular component structure makes it easy to:
- Add new form sections
- Integrate with backend APIs
- Add more validation rules
- Implement different submission methods
When contributing to this project, please:
- Maintain accessibility standards
- Add proper TypeScript types
- Include appropriate ARIA attributes
- Test with keyboard navigation
- Verify screen reader compatibility
- Follow the existing code structure and naming conventions
This project is open source and available under the MIT License.
- Built with accessibility-first principles
- Follows WCAG 2.1 AA guidelines
- Inspired by modern design systems
- Uses industry-standard React patterns
For questions or support, please refer to the component documentation within the codebase or create an issue in the project repository.