Skip to content

Update Dec. 5th#121

Merged
Deodat-Lawson merged 12 commits intostablefrom
main
Dec 14, 2025
Merged

Update Dec. 5th#121
Deodat-Lawson merged 12 commits intostablefrom
main

Conversation

@Deodat-Lawson
Copy link
Copy Markdown
Owner

No description provided.

Deodat-Lawson and others added 7 commits November 17, 2025 13:04
This PR significantly improves the accessibility of the chat interface by adding comprehensive ARIA labels, implementing keyboard shortcuts, and enhancing screen reader support.

## Changes

### ARIA Labels & Screen Reader Support

**Chat Container**
- Added `role="region"` and `aria-label` to main chat interface
- Added `role="log"` with `aria-live="polite"` to message container for dynamic message announcements
- Added `role="status"` with `aria-live="polite"` to loading indicator

**Interactive Elements**
- Added `aria-label` to all buttons (upvote, downvote, tools, send)
- Added `aria-hidden="true"` to decorative icons
- Added `type="button"` to prevent form submission on action buttons
- Added `role="group"` with `aria-label` to message action buttons
- Added `role="menu"` and `role="menuitem"` to tools dropdown
- Added `aria-expanded` and `aria-haspopup` to tools toggle button

**Form & Input**
- Added `aria-label` to form and textarea
- Added `aria-multiline="true"` to textarea
- Added `role="alert"` with `aria-live="assertive"` to error messages
- Enhanced placeholder text with keyboard shortcut hints

### Keyboard Navigation

**Escape Key**
- Press `Escape` to close the tools menu when open
- Press `Escape` to clear the input field when tools menu is closed
- Auto-focuses textarea after clearing

**Enter Key**
- Existing: Send message with `Enter` (Shift+Enter for new line)
- Now properly documented in UI with tooltip

### UX Improvements

- Fixed textarea overflow by changing from `overflow: hidden` to `overflow-y: auto`
- Enhanced tooltips with keyboard shortcut information
- Improved placeholder text to include "(Press Escape to clear)"
- Better visual feedback for screen reader users

## Testing

Tested with:
- ✅ VoiceOver (macOS) - All interactive elements properly announced
- ✅ Keyboard-only navigation - All features accessible without mouse
- ✅ NVDA screen reader simulation - Proper role and state announcements
- ✅ Chrome DevTools Accessibility Inspector - No violations detected
- ✅ Manual keyboard testing - Escape and Enter shortcuts working correctly

## Accessibility Standards

This PR follows WCAG 2.1 Level AA guidelines:
- **1.3.1 Info and Relationships**: Proper semantic structure with ARIA
- **2.1.1 Keyboard**: Full keyboard accessibility
- **4.1.2 Name, Role, Value**: All UI components properly labeled

## Impact

These improvements make the chat interface:
- Fully navigable with keyboard only
- Compatible with screen readers
- More discoverable for all users (keyboard shortcuts in UI)
- Compliant with modern accessibility standards

No breaking changes - purely additive accessibility enhancements.
Implemented a comprehensive rate limiting system to protect against API abuse and control costs for expensive AI operations.

Features:
- Token bucket algorithm for smooth rate limiting
- In-memory store with automatic cleanup
- Standard rate limit headers (X-RateLimit-*)
- Multiple rate limit presets (standard, strict, permissive, burst)
- IP-based rate limiting with support for various proxy headers
- Custom key generators and skip functions
- Comprehensive test coverage

Applied rate limiting to:
- /api/AIAssistant (20 req/15min) - AI chat with embeddings
- /api/uploadDocument (20 req/15min) - Document upload with OCR
- /api/predictive-document-analysis (20 req/15min) - AI analysis

Benefits:
- Protects against API cost overruns
- Prevents abuse and DoS attacks
- Professional API design with standard headers
- Easy to extend with Redis for distributed systems

Technical implementation:
- src/lib/rate-limiter.ts: Core rate limiting logic
- src/lib/rate-limit-middleware.ts: Next.js middleware helpers
- Comprehensive unit tests for both modules
- Clean integration with existing API routes
…a-into-multiple-files

Split Drizzle schema into modular files
…ents

Enhance accessibility with ARIA labels and keyboard navigation
Add API rate limiting for expensive operations
@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
pdr-ai-v2 Ready Ready Preview, Comment Dec 14, 2025 0:48am

@Deodat-Lawson Deodat-Lawson merged commit 36d3a43 into stable Dec 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants