Skip to content

Conversation

@mystster
Copy link

@mystster mystster commented Nov 8, 2025

This branch introduces support for wheel (scroll) gestures to improve mouse-based navigation.

High-level changes:

Implement wheel gesture input handling (controller and configuration)
Update Preferences UI to expose related settings
Add i18n keys and locale updates for multi-language support

Currently, the wheel gesture is limited to tab switching only. Please let us know if it is a requirement to allow users to customize the wheel gesture action for this PR to be approved.

…mouse-gesture config and controller - Add UI changes in Preferences.tsx
- Insert "wheelGesturesEnabled" entry under mouseGesture in locale JSON files
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mystster, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new feature that enables mouse wheel gestures for improved navigation within the application. It integrates the necessary configuration, event handling logic, and user interface elements to support this functionality. Initially, the wheel gestures are specifically designed for efficient tab switching, with the potential for further customization based on user feedback.

Highlights

  • Configuration Update: A new "wheelGesturesEnabled" property has been added to the mouse gesture configuration, allowing users to enable or disable this feature.
  • Controller Logic: The mouse gesture controller now listens for "wheel" events and includes a new handler ("handleMouseWheel") to process these gestures.
  • Tab Switching: The implemented wheel gesture functionality is currently dedicated to switching between tabs (previous/next tab).
  • User Interface: A new toggle switch for "wheelGesturesEnabled" has been integrated into the Preferences UI, making the feature configurable.
  • Internationalization: Corresponding i18n keys for the new wheel gesture setting have been added across all supported locales.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for wheel gestures, which is a great enhancement for mouse navigation. The implementation is mostly solid, but I've identified a few areas for improvement regarding code maintainability, type consistency, and internationalization. Specifically, there's some duplicated code that could be refactored, a type inconsistency between the feature's configuration and the settings page, and several missing or partial translations for the new UI text. Addressing these points will improve the overall quality and robustness of the feature.

Comment on lines +95 to +96
checked={config.wheelGesturesEnabled ?? true}
onChange={() => updateConfig({ wheelGesturesEnabled: !(config.wheelGesturesEnabled ?? true) })}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The use of the nullish coalescing operator (?? true) suggests that config.wheelGesturesEnabled might be optional. However, this property is defined as required in browser-features/chrome/common/mouse-gesture/config.ts. This inconsistency indicates that the MouseGestureConfig type in browser-features/pages-settings/src/types/pref.ts is out of sync with the main configuration. To ensure type safety and consistency, the type definition in pref.ts should be updated to include wheelGesturesEnabled as a required boolean property. After that, the ?? true will no longer be necessary.

Suggested change
checked={config.wheelGesturesEnabled ?? true}
onChange={() => updateConfig({ wheelGesturesEnabled: !(config.wheelGesturesEnabled ?? true) })}
checked={config.wheelGesturesEnabled}
onChange={() => updateConfig({ wheelGesturesEnabled: !config.wheelGesturesEnabled })}

Comment on lines +254 to +259
let action: string | null = null;
if (event.deltaY < 0) {
action = "gecko-show-previous-tab";
} else if (event.deltaY > 0) {
action = "gecko-show-next-tab";
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The action strings gecko-show-previous-tab and gecko-show-next-tab are hardcoded. It's a good practice to define them as constants to improve readability and make them easier to manage, especially if they might be used elsewhere or become configurable in the future.

    const WHEEL_UP_ACTION = "gecko-show-previous-tab";
    const WHEEL_DOWN_ACTION = "gecko-show-next-tab";
    let action: string | null = null;
    if (event.deltaY < 0) {
      action = WHEEL_UP_ACTION;
    } else if (event.deltaY > 0) {
      action = WHEEL_DOWN_ACTION;
    }

Comment on lines +268 to +274
if (this.preventionTimeoutId) {
clearTimeout(this.preventionTimeoutId);
}
this.preventionTimeoutId = setTimeout(() => {
this.isContextMenuPrevented = false;
this.preventionTimeoutId = null;
}, getConfig().contextMenu.preventionTimeout);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This block of code for managing the context menu prevention timeout is duplicated in other parts of this class (e.g., in handleMouseUp). To improve code maintainability and reduce redundancy, consider extracting this logic into a private helper method. This will make the code cleaner and less error-prone when future changes are needed.

"actionDescription": "Description of the gesture",
"rockerGesturesEnabled": "Enable rocker gestures",
"rockerGesturesDescription": "Right-click and move left to go back, right-click and move right to go forward. (Experimental)",
"wheelGesturesEnabled": "Enable wheel gestures",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The value for wheelGesturesEnabled is not translated into Arabic. Please provide the correct translation. This seems to be the case for several other languages as well.

"actionDescription": "Hareketin açıklaması",
"rockerGesturesEnabled": "Rocker hareketlerini etkinleştirin",
"rockerGesturesDescription": "Geri gitmek için sağ tıklayın ve sola hareket edin, ileri gitmek için sağ tıklayın ve sağa hareket edin. (Deneysel)",
"wheelGesturesEnabled": "Wheel hareketlerini etkinleştirin",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The translation for wheelGesturesEnabled seems to be partial. The word 'Wheel' is in English. A better translation might be 'Tekerlek hareketlerini etkinleştirin'.

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.

1 participant