mirror of
https://github.com/pacnpal/thrillwiki_laravel.git
synced 2025-12-20 17:31:11 -05:00
3.1 KiB
3.1 KiB
Search Components Documentation
AutocompleteComponent
Features
- Real-time suggestions with 300ms debounce
- Keyboard navigation (up/down/enter)
- Dark mode compatibility
- Mobile-responsive design
- Accessibility support (ARIA labels, roles)
Keyboard Shortcuts
↑- Navigate to previous suggestion↓- Navigate to next suggestionEnter- Select current suggestionEsc- Clear and close suggestions
Usage Example
<livewire:autocomplete-component
:endpoint="route('api.search.suggestions')"
:placeholder="'Search for rides, parks...'"
/>
Integration with SearchComponent
The AutocompleteComponent works seamlessly with SearchComponent through:
- Event communication for selected suggestions
- Shared state management
- Coordinated filter updates
SearchComponent
Features
- Real-time filtering
- Multiple filter combinations
- State persistence
- Dark mode support
- Mobile-responsive layout
Filter Combinations
Valid filter combinations include:
- Type (park, ride, area)
- Location (country, region)
- Status (open, closed, planned)
- Category (specific to type)
Mobile Responsiveness
- Collapsible filter panel
- Touch-friendly inputs
- Responsive grid layout
- Optimized for various screen sizes
Dark Mode Implementation
- Consistent with system theme
- Maintains contrast ratios
- Preserves readability
- Smooth transitions
Performance Considerations
- 300ms debounce on search input
- Optimized query execution
- Minimal re-renders
- Efficient state updates
Accessibility Features
ARIA Attributes
aria-expanded: Indicates suggestion panel statearia-activedescendant: Identifies active suggestionaria-controls: Links input to suggestionsrole="combobox": Identifies autocomplete inputrole="listbox": Identifies suggestions list
Keyboard Support
- Full keyboard navigation
- Focus management
- Skip links
- Clear focus indicators
Screen Reader Support
- Meaningful labels
- Status announcements
- Clear instructions
- Error notifications
API Integration
Endpoints
-
/api/search/suggestions- Returns autocomplete suggestions
- Parameters: query, type, limit
- Response: JSON array of matches
-
/api/search- Performs full search
- Parameters: query, filters, page
- Response: Paginated results
Response Format
{
"data": [...],
"meta": {
"total": 100,
"per_page": 15,
"current_page": 1
}
}
Testing Guidelines
Filter Testing
- Test all possible filter combinations
- Verify filter state persistence
- Check filter reset functionality
- Validate filter validation rules
Keyboard Navigation Testing
- Test arrow key navigation
- Verify enter key selection
- Check escape key behavior
- Validate focus management
Mobile Testing
- Test on various screen sizes
- Verify touch interactions
- Check responsive layouts
- Validate filter panel behavior
Dark Mode Testing
- Test theme switching
- Verify color contrast
- Check transition effects
- Validate component states