Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(shortcuts): add missing tab and navigation hotkeys to shortcut settings (#3303) - #8896

#8896
Open
NoahMenezes wants to merge 1 commit into
AppFlowy-IO:mainAppFlowy-IO/AppFlowy:mainfrom
NoahMenezes:fix/add-tab-shortcutsNoahMenezes/AppFlowy:fix/add-tab-shortcutsCopy head branch name to clipboard
Open

fix(shortcuts): add missing tab and navigation hotkeys to shortcut settings (#3303)#8896
NoahMenezes wants to merge 1 commit into
AppFlowy-IO:mainAppFlowy-IO/AppFlowy:mainfrom
NoahMenezes:fix/add-tab-shortcutsNoahMenezes/AppFlowy:fix/add-tab-shortcutsCopy head branch name to clipboard

Conversation

@NoahMenezes

@NoahMenezes NoahMenezes commented Jul 27, 2026

Copy link
Copy Markdown

…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.dart and mapped their display labels in settings_shortcuts_view.dart.

Closes #3303

PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Add definitions and settings labels for missing tab and navigation keyboard shortcuts.

New Features:

  • Introduce command shortcut definitions for closing tabs, switching tabs, collapsing the sidebar, and toggling theme mode.
  • Expose the new tab and navigation shortcuts with human-readable labels in the shortcut settings UI.

@sourcery-ai

sourcery-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds 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 settings

flowchart 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"]
Loading

File-Level Changes

Change Details Files
Define platform-aware command shortcut events for tab/navigation actions and register them in the default command shortcut set.
  • Imported dart:io to access Platform for OS-specific key combinations and flutter/material.dart for KeyEventResult usage.
  • Declared CommandShortcutEvent instances for closing current tab, navigating to next/previous tab, collapsing sidebar, and toggling theme mode, each with appropriate key identifiers, descriptions, and platform-specific command strings.
  • Set all new shortcut handlers to return KeyEventResult.ignored, making them representable and remappable without altering current behavior.
  • Appended the new command shortcut events into the commandShortcutEvents list before pruning standard shortcuts.
frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/shortcuts/command_shortcuts.dart
Map the new command shortcut events to display labels in the settings shortcuts view so they appear correctly in the keybinding UI.
  • Extended the CommandLabel.afLabel extension to return human-readable strings for the new close tab, next/previous tab, collapse sidebar, and toggle theme mode shortcuts based on their keys.
  • Ensured existing label mappings (e.g., toggleToggleListCommand and others below) continue to work by chaining the new conditions before the existing ones.
frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/settings_shortcuts_view.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@CLAassistant

CLAassistant commented Jul 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@NoahMenezes

Copy link
Copy Markdown
Author

Missing tab

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@NoahMenezes NoahMenezes changed the title fix(shortcuts): add missing tab and navigation hotkeys to shortcut se… fix(shortcuts): add missing tab and navigation hotkeys to shortcut settings (#3303) Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.