# Keyboard Navigation Guide - nself-admin This document describes all keyboard shortcuts and navigation patterns in the nself-admin application to ensure full keyboard accessibility. --- ## Global Keyboard Shortcuts ### Navigation - **Tab** - Move focus to next interactive element - **Shift + Tab** - Move focus to previous interactive element - **Enter** - Activate focused link or button - **Space** - Activate focused button or checkbox - **Escape** - Close modals, dialogs, dropdowns ### Skip Links - **Tab (from page load)** - Focus skip link (visible on focus) - **Enter (on skip link)** - Jump directly to main content --- ## Page-Specific Navigation ### Login Page (`/login`) **Tab Order:** 1. Username field (if shown) 2. Password field 3. Show/hide password button 4. Confirm password field (setup mode only) 5. Show/hide confirm password button (setup mode only) 6. Remember me checkbox (login mode only) 7. Submit button **Keyboard Actions:** - **Enter** (in password field) - Submit form - **Space** (on show/hide password) - Toggle password visibility - **Space** (on remember me checkbox) - Toggle checkbox **ARIA Live Regions:** - Caps Lock warning announced when detected - Password strength announced as you type (setup mode) - Error messages announced with role="alert" - Rate limit warnings announced --- ### Dashboard (`/`) **Tab Order:** 1. Skip to main content link 2. Search field 3. Mobile navigation toggle 4. Theme toggle 5. Logout button 6. Navigation sections (collapsible) 7. Service cards 8. Action buttons on each card **Navigation Section Interaction:** - **Enter/Space** - Expand/collapse section - **Tab** - Navigate to links within expanded section - **aria-expanded** announces state to screen readers **Service Cards:** - **Tab** - Navigate through service cards - **Enter** - Activate focused button (Start, Stop, Restart, View Logs, etc.) **ARIA Live Regions:** - System alerts announced as they appear (role="alert" for critical, role="status" for warnings) - Activity feed updates announced (aria-live="polite") --- ### Services Page (`/services/*`) **Tab Order:** 1. Skip to main content 2. Main navigation 3. Service-specific tabs/controls 4. Service actions (start, stop, restart) 5. Logs viewer 6. Configuration forms **Service Actions:** - **Enter** - Execute action (start, stop, restart) - Service status announced via sr-only text --- ### Configuration Pages (`/config/*`) **Tab Order:** 1. Skip to main content 2. Main navigation 3. Environment tabs 4. Form fields 5. Save/Cancel buttons **Environment Tabs:** - **Left Arrow** - Previous tab - **Right Arrow** - Next tab - **Home** - First tab - **End** - Last tab - **Tab** - Exit tab list to form fields **Form Fields:** - **Tab** - Next field - **Shift + Tab** - Previous field - **Enter** - Submit form (on submit button) - **Escape** - Cancel/close (if in modal) --- ## Component-Specific Patterns ### Modals/Dialogs **Focus Management:** 1. When modal opens, focus moves to first interactive element 2. Focus is trapped within modal (Tab cycles through modal only) 3. **Escape** closes modal 4. When modal closes, focus returns to trigger element **Tab Order within Modal:** 1. Close button 2. Modal content interactive elements 3. Action buttons (Cancel, Confirm, etc.) **ARIA:** - `role="dialog"` - `aria-modal="true"` - `aria-labelledby` points to modal title - `aria-describedby` points to modal description --- ### Collapsible Navigation Groups **Interaction:** - **Enter/Space** on group header - Expand/collapse - **Tab** - Navigate to next group or link - **Shift + Tab** - Navigate to previous **ARIA:** - `aria-expanded="true|false"` announces state - `aria-label` describes action (e.g., "Expand Services section") --- ### Forms **Focus Order:** 1. First form field 2. Subsequent fields in logical order 3. Submit button 4. Cancel/Reset button (if present) **Error Handling:** - Errors announced via `role="alert"` - Fields with errors have `aria-invalid="true"` - `aria-describedby` links field to error message **Required Fields:** - Visual indicator (red asterisk) - `aria-label="required"` on asterisk - `required` attribute on input --- ### Dropdowns/Select Menus **Interaction:** - **Enter/Space** - Open dropdown - **Arrow Down** - Next option - **Arrow Up** - Previous option - **Home** - First option - **End** - Last option - **Enter** - Select focused option - **Escape** - Close dropdown without selecting **ARIA:** - `role="combobox"` or `role="listbox"` - `aria-expanded` announces state - `aria-activedescendant` announces focused option --- ### Data Tables **Navigation:** - **Tab** - Next interactive element in table - **Shift + Tab** - Previous interactive element **Structure:** - `