fix(shortcuts): add missing tab and navigation hotkeys to shortcut settings (#3303) - #8896
#8896fix(shortcuts): add missing tab and navigation hotkeys to shortcut settings (#3303)#8896NoahMenezes wants to merge 1 commit intoAppFlowy-IO:mainAppFlowy-IO/AppFlowy:mainfrom NoahMenezes:fix/add-tab-shortcutsNoahMenezes/AppFlowy:fix/add-tab-shortcutsCopy head branch name to clipboard
Conversation
Reviewer's GuideAdds missing tab and navigation shortcut command definitions to the editor shortcut registry and exposes them with human‑readable labels in the settings shortcuts view, using platform-specific key combinations while keeping handlers as no-ops for now. Flow diagram for new tab and navigation shortcuts in settingsflowchart LR
subgraph ShortcutsDefinition
closeTabCommand[closeTabCommand]
nextTabCommand[nextTabCommand]
previousTabCommand[previousTabCommand]
collapseSidebarCommand[collapseSidebarCommand]
toggleThemeModeCommand[toggleThemeModeCommand]
commandShortcutEvents[commandShortcutEvents]
end
closeTabCommand --> commandShortcutEvents
nextTabCommand --> commandShortcutEvents
previousTabCommand --> commandShortcutEvents
collapseSidebarCommand --> commandShortcutEvents
toggleThemeModeCommand --> commandShortcutEvents
commandShortcutEvents --> defaultCommandShortcutEvents[defaultCommandShortcutEvents]
defaultCommandShortcutEvents --> SettingsShortcutsView[SettingsShortcutsView]
SettingsShortcutsView --> CommandLabel_afLabel[CommandLabel.afLabel]
CommandLabel_afLabel --> CloseTabLabel["Close current tab"]
CommandLabel_afLabel --> NextTabLabel["Go to next tab"]
CommandLabel_afLabel --> PreviousTabLabel["Go to previous tab"]
CommandLabel_afLabel --> CollapseSidebarLabel["Collapse sidebar menu"]
CommandLabel_afLabel --> ToggleThemeLabel["Toggle theme mode"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Missing tab |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Using
Platform.isMacOSfromdart:ioincommand_shortcuts.dartwill break on web; consider using a platform-agnostic helper (e.g.,Theme.of(context).platformor a shared platform util with conditional imports) instead of directly importingdart:io. - The new shortcut labels (
getDescriptionandafLabel) are hard-coded English strings, while the rest of the file uses localization keys; wiring these throughLocaleKeyswill keep them consistent with the rest of the app's i18n. - The shortcut label strings are duplicated between
getDescriptionandafLabel; it might be cleaner to centralize them (e.g., via a shared map or common getter) to avoid divergence in future updates.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Using `Platform.isMacOS` from `dart:io` in `command_shortcuts.dart` will break on web; consider using a platform-agnostic helper (e.g., `Theme.of(context).platform` or a shared platform util with conditional imports) instead of directly importing `dart:io`.
- The new shortcut labels (`getDescription` and `afLabel`) are hard-coded English strings, while the rest of the file uses localization keys; wiring these through `LocaleKeys` will keep them consistent with the rest of the app's i18n.
- The shortcut label strings are duplicated between `getDescription` and `afLabel`; it might be cleaner to centralize them (e.g., via a shared map or common getter) to avoid divergence in future updates.
## Individual Comments
### Comment 1
<location path="frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/shortcuts/command_shortcuts.dart" line_range="1" />
<code_context>
+import 'dart:io';
+
import 'package:appflowy/generated/locale_keys.g.dart';
</code_context>
<issue_to_address>
**issue (bug_risk):** Using `dart:io` directly may break web builds; consider guarding or using a platform-agnostic approach.
If this file is ever compiled for web, the `dart:io` import and use of `Platform.isMacOS` will cause a compile-time error. Consider either moving this logic to a desktop-only module, using conditional imports, or switching to a platform-detection approach based on Flutter primitives (e.g., `defaultTargetPlatform` or theme/platform channels) instead of `dart:io`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| @@ -1,3 +1,5 @@ | ||
| import 'dart:io'; |
There was a problem hiding this comment.
issue (bug_risk): Using dart:io directly may break web builds; consider guarding or using a platform-agnostic approach.
If this file is ever compiled for web, the dart:io import and use of Platform.isMacOS will cause a compile-time error. Consider either moving this logic to a desktop-only module, using conditional imports, or switching to a platform-detection approach based on Flutter primitives (e.g., defaultTargetPlatform or theme/platform channels) instead of dart:io.
…ttings (#3303)
Feature Preview
Summary of Changes
Added missing tab and navigation hotkey command definitions (Close current tab, Go to next tab, Go to previous tab, Collapse sidebar, Toggle theme mode) to
command_shortcuts.dartand mapped their display labels insettings_shortcuts_view.dart.Closes #3303
PR Checklist
Summary by Sourcery
Add definitions and settings labels for missing tab and navigation keyboard shortcuts.
New Features: