The Ubuntu Autoinstall Configuration Builder now has fully cross-platform keyboard shortcuts that work seamlessly on Windows, macOS, and Linux!
| Platform | Modifier Key | Status | Symbol |
|---|---|---|---|
| macOS | ⌘ Command | ✅ Fully Supported | ⌘ |
| Windows | Ctrl | ✅ Fully Supported | Ctrl |
| Linux | Ctrl | ✅ Fully Supported | Ctrl |
The system automatically detects the user's operating system:
detectMac() {
return navigator.platform.toUpperCase().indexOf('MAC') >= 0 ||
navigator.userAgent.toUpperCase().indexOf('MAC') >= 0;
}When registering shortcuts, use mod instead of ctrl:
// ✅ Correct - Works on all platforms
shortcuts.register('mod+s', downloadYAML, 'Download YAML file');
// ❌ Incorrect - Only works on Windows/Linux
shortcuts.register('ctrl+s', downloadYAML, 'Download YAML file');The event handler listens for both Ctrl and Command keys:
handleKeyDown(event) {
const keys = [];
// Support both Ctrl (Windows/Linux) and Cmd (macOS)
if (event.ctrlKey || event.metaKey) keys.push('ctrl');
// ... process the shortcut
}Shortcuts are displayed with the correct symbols for each platform:
On macOS:
⌘ S(Command + S)⌘ ⇧ C(Command + Shift + C)⌘ Z(Command + Z)
On Windows/Linux:
Ctrl+SCtrl+Shift+CCtrl+Z
All 15+ keyboard shortcuts work across all platforms:
Mod+S- Download autoinstall.yamlMod+O- Load YAML fileMod+B- Save to bookmark
Mod+Z- Undo last changeMod+Y- Redo last changeMod+Shift+Y- Redo (alternative)
Mod+K- Open version managerMod+/- Show keyboard shortcutsMod+Shift+C- Copy YAML to clipboardMod+Shift+V- Validate configurationMod+Shift+T- Open templates
←/→- Navigate between tabsHome- Go to first tabEnd- Go to last tabEsc- Close modal/dialog
The shortcuts modal now shows:
- Platform indicator badge: 🍎 macOS, 🪟 Windows, or 🐧 Linux
- Info box: Explains which modifier key to use
- Platform-specific shortcuts: Displays ⌘ or Ctrl based on OS
- Responsive layout: Works on mobile and desktop
Button tooltips show the correct shortcut:
- macOS: "Undo (⌘+Z)"
- Windows/Linux: "Undo (Ctrl+Z)"
The interactive tour dynamically shows shortcuts:
- Detects platform on tour start
- Shows ⌘ symbols on Mac
- Shows Ctrl notation elsewhere
- Includes platform indicator
1. Open the app on Mac
2. Press ⌘+S → Should download YAML
3. Press ⌘+Z → Should undo
4. Press ⌘+/ → Should show shortcuts with ⌘ symbols
1. Open the app on Windows
2. Press Ctrl+S → Should download YAML
3. Press Ctrl+Z → Should undo
4. Press Ctrl+/ → Should show shortcuts with Ctrl notation
1. Open the app on Linux
2. Press Ctrl+S → Should download YAML
3. Press Ctrl+Z → Should undo
4. Press Ctrl+/ → Should show shortcuts with Ctrl notation
class KeyboardShortcuts {
detectMac() // Detect if user is on macOS
getModifierKey() // Get 'Cmd' or 'Ctrl'
formatDisplayKey(key) // Format for display (⌘ S or Ctrl+S)
register(key, callback, desc) // Register shortcut with 'mod' support
handleKeyDown(event) // Handle both ctrlKey and metaKey
getPlatformInfo() // Get detailed platform info
getAll() // Get all shortcuts with display keys
}The system checks:
navigator.platform(primary method)navigator.userAgent(fallback)
Recognized platforms:
'MAC'in platform → macOS'WIN'in platform → Windows'LINUX'in platform → Linux
| Input | macOS Output | Windows/Linux Output |
|---|---|---|
mod |
⌘ | Ctrl |
ctrl |
⌘ | Ctrl |
alt |
⌥ | Alt |
shift |
⇧ | Shift |
// ✅ Good
shortcuts.register('mod+s', callback);
shortcuts.register('mod+shift+p', callback);
// ❌ Bad
shortcuts.register('ctrl+s', callback); // Won't work on Mac
shortcuts.register('cmd+s', callback); // Won't work on Windows/LinuxIf possible, test shortcuts on:
- At least one Mac
- At least one Windows or Linux machine
- Different browsers (Chrome, Firefox, Safari, Edge)
Don't use keys that don't exist on all platforms:
- ❌ F13-F24 (not on all keyboards)
- ❌ Browser-specific keys
- ✅ Letters, numbers, arrows
- ✅ Common keys (Home, End, Esc)
- Universal Experience: Same shortcuts work everywhere
- Native Feel: Uses platform conventions (⌘ on Mac, Ctrl elsewhere)
- No Configuration: Automatically adapts to user's platform
- Clear Communication: UI shows correct keys for each platform
- Accessibility: Keyboard navigation works identically everywhere
- Integration Guide: See
INTEGRATION_GUIDE.mdfor implementation details - utils.js: See
KeyboardShortcutsclass for full implementation - components.js: See
KeyboardShortcutsModalfor UI implementation
The keyboard shortcuts system is now fully cross-platform with:
- ✅ Automatic platform detection
- ✅ Universal 'mod' key support
- ✅ Platform-specific symbol display
- ✅ Smart event handling (Ctrl + Cmd)
- ✅ Responsive UI with platform indicators
- ✅ 15+ shortcuts working on all platforms
No manual configuration required - it just works! 🎉