Keyboard Shortcuts
Comprehensive guide to keyboard navigation and shortcuts in Shyfts, designed for power users and accessibility compliance.
Overview
Shyfts is designed to be fully keyboard accessible, following WCAG 2.1 AA guidelines. While the application prioritises touch-friendly mobile interactions, all features can be accessed via keyboard.
| Category | Description |
|---|---|
| Navigation | Move between pages and elements |
| Modals | Open and close dialogs |
| Forms | Submit and navigate form fields |
| Messaging | Compose and send messages |
| Session | Activity tracking and timeout management |
Global Shortcuts
Standard Web Navigation
| Shortcut | Action |
|---|---|
Tab | Move to next focusable element |
Shift + Tab | Move to previous focusable element |
Enter | Activate focused link or button |
Space | Activate focused button or checkbox |
Escape | Close modal or menu |
Focus Indicators
All focusable elements display a visible focus indicator:
- Links and buttons show a ring outline
- Form inputs highlight with border colour change
- Interactive cards display elevation and scale effects
Modal Shortcuts
Closing Modals
Shortcut: Escape
All modal dialogs in Shyfts can be closed by pressing the Escape key:
// Source: src/components/modals/LogoutConfirmModal.tsx:20-31
React.useEffect(() => {
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
onClose()
}
}
if (isOpen) {
document.addEventListener('keydown', handleEscape)
return () => document.removeEventListener('keydown', handleEscape)
}
}, [isOpen, onClose])
Applies to:
- Logout confirmation modal
- Shift creation/edit modals
- Leave request modals
- Staff profile modals
- Session timeout warning
Focus Trapping
When a modal is open, focus is trapped within the modal:
| Shortcut | Behaviour |
|---|---|
Tab | Cycle forward through modal elements |
Shift + Tab | Cycle backward through modal elements |
| Focus wraps from last to first element |
This prevents keyboard users from accidentally navigating outside the modal.
Mobile Menu Shortcuts
The mobile navigation menu includes full keyboard support.
Opening the Menu
- Navigate to the hamburger menu button using
Tab - Press
EnterorSpaceto open
Within the Menu
| Shortcut | Action |
|---|---|
Tab | Move to next menu item |
Shift + Tab | Move to previous menu item |
Enter | Activate menu link |
Escape | Close menu |
// Source: src/components/navigation/MobileMenu.tsx:85-110
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Tab') {
const focusableElements = menuRef.current?.querySelectorAll<HTMLElement>(
'a, button, [tabindex]:not([tabindex="-1"])'
)
if (!focusableElements || focusableElements.length === 0) return
const firstElement = focusableElements[0]
const lastElement = focusableElements[focusableElements.length - 1]
if (e.shiftKey && document.activeElement === firstElement) {
e.preventDefault()
lastElement?.focus()
} else if (!e.shiftKey && document.activeElement === lastElement) {
e.preventDefault()
firstElement?.focus()
}
} else if (e.key === 'Escape') {
onClose()
}
}
Touch Equivalent
On touch devices, swipe left (50px threshold) to close the menu.
Messaging Shortcuts
Message Composer
When composing messages in the inbox:
| Shortcut | Action |
|---|---|
Enter | Send message immediately |
Shift + Enter | Insert new line (multi-line message) |
// Source: src/components/messages/MessageThread.tsx:160-165
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault()
sendMessage()
}
}
Press Enter to send your message instantly. Use Shift + Enter if you need to add line breaks within your message.
Message Composer Placeholder
The message input shows a reminder:
Write a message... (Enter to send, Shift+Enter for new line)
Calendar Shortcuts
Navigating Shifts
Shift blocks in the calendar are keyboard focusable:
// Source: src/components/calendar/ShiftBlock.tsx:59-61
role="button"
tabIndex={0}
aria-label={`Shift for ${shift.staff?.first_name} ${shift.staff?.last_name}`}
| Shortcut | Action |
|---|---|
Tab | Move to next shift block |
Shift + Tab | Move to previous shift block |
Enter or Space | Open shift details |
Drag Operations
Currently, drag-and-drop operations (moving shifts between times/rooms) require mouse or touch interaction. Keyboard-accessible shift editing is available through:
- Focus the shift block
- Press
Enterto open details - Edit time/room in the modal form
- Submit changes
Form Shortcuts
Standard Form Navigation
| Shortcut | Action |
|---|---|
Tab | Move to next form field |
Shift + Tab | Move to previous form field |
Enter | Submit form (in most cases) |
Space | Toggle checkbox or radio |
Arrow keys | Navigate select options |
Date and Time Inputs
| Shortcut | Action |
|---|---|
Arrow Up/Down | Increment/decrement value |
Tab | Move between date segments |
Enter | Confirm selection |
Form Validation
Invalid fields are announced to screen readers and display visual error indicators.
Session Management
Activity Tracking
The session monitor tracks keyboard activity to reset the inactivity timer:
// Source: src/components/auth/SessionMonitor.tsx:94
const events = ['mousedown', 'keydown', 'scroll', 'touchstart', 'click']
events.forEach(event => {
window.addEventListener(event, handleActivity)
})
Session Behaviour:
- Session timeout: 30 minutes of inactivity
- Warning appears: 5 minutes before timeout
- Any keyboard activity resets the timer
Session Timeout Modal
When the session warning appears:
| Action | Keyboard Access |
|---|---|
| Continue working | Tab to "Continue" button, Enter |
| Logout | Tab to "Logout" button, Enter |
| Dismiss | Escape (continues session) |
Accessibility Features
Skip Links
Skip links allow keyboard users to bypass repetitive navigation:
- Press
Tabimmediately after page load - A "Skip to content" link appears
- Press
Enterto jump to main content
ARIA Labels
All interactive elements include descriptive labels for screen readers:
// Example: Shift block aria-label
aria-label={`Shift for ${shift.staff?.first_name} ${shift.staff?.last_name}`}
// Example: Mobile menu close button
aria-label="Close mobile menu"
Focus Management
- Focus returns to trigger element when modals close
- New page content announces to screen readers
- Error messages are announced immediately
Touch Targets
All interactive elements maintain 44px minimum touch/click targets for accessibility:
// Source: src/components/navigation/MobileMenu.tsx:193
className="min-h-[44px]" // 44px touch target
This ensures keyboard users with motor impairments can easily activate elements.
Quick Reference Card
Modal/Menu Shortcuts
| Context | Shortcut | Action |
|---|---|---|
| Any modal | Escape | Close modal |
| Mobile menu | Escape | Close menu |
| Modal | Tab | Next element (trapped) |
| Modal | Shift + Tab | Previous element (trapped) |
Messaging Shortcuts
| Context | Shortcut | Action |
|---|---|---|
| Message input | Enter | Send message |
| Message input | Shift + Enter | New line |
Navigation Shortcuts
| Context | Shortcut | Action |
|---|---|---|
| Global | Tab | Next focusable element |
| Global | Shift + Tab | Previous focusable element |
| Global | Enter | Activate link/button |
| Global | Space | Activate button/checkbox |
Browser Shortcuts
Shyfts supports standard browser shortcuts that work across all pages:
| Shortcut | Action |
|---|---|
Ctrl/Cmd + R | Refresh page |
Ctrl/Cmd + F | Search on page |
Alt + Left Arrow | Go back |
Alt + Right Arrow | Go forward |
F11 | Toggle fullscreen |
Screen Reader Support
Shyfts is compatible with popular screen readers:
| Screen Reader | Platform | Support |
|---|---|---|
| NVDA | Windows | ✅ Full |
| JAWS | Windows | ✅ Full |
| VoiceOver | macOS/iOS | ✅ Full |
| TalkBack | Android | ✅ Full |
Announcements
The application announces:
- Page navigation changes
- Form validation errors
- Toast notifications
- Modal open/close events
- Session timeout warnings
Related Documentation
- Interface Tour - Visual interface guide
- Common Tasks - Task-based workflows
- First Login - Getting started
Source Files:
src/components/navigation/MobileMenu.tsx- Mobile menu keyboard handlingsrc/components/modals/LogoutConfirmModal.tsx- Modal escape key handlingsrc/components/messages/MessageThread.tsx- Message composer shortcutssrc/components/auth/SessionMonitor.tsx- Activity trackingsrc/components/calendar/ShiftBlock.tsx- Calendar accessibility