Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpui: Add restrict_scroll_to_axis to match web scrolling behavior #25963

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

maxdeviant
Copy link
Member

This PR adds a new restrict_scroll_to_axis style to allow consumers to opt-in to the scrolling behavior found on the web.

When this is enabled the behavior will be such that:

  • Scrolling using the mouse wheel will only scroll the Y axis
  • Scrolling using the mouse wheel with Shift held will only scroll the X axis

This behavior is useful in scenarios where you have some vertically-scrollable content that is interspersed with horizontally-scrollable elements, as otherwise the scroll will be constantly hijacked by the horizontally-scrollable elements while trying to scroll up and down in the vertically-scrollable container.

I think that this behavior should be the default, but it's a bit of a sweeping change to make all at once, so for now it remains opt-in.

Release Notes:

  • N/A

@maxdeviant maxdeviant self-assigned this Mar 3, 2025
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Mar 3, 2025
@maxdeviant maxdeviant enabled auto-merge (squash) March 3, 2025 21:56
@maxdeviant maxdeviant disabled auto-merge March 3, 2025 22:06
@maxdeviant maxdeviant merged commit 7321c81 into main Mar 3, 2025
12 checks passed
@maxdeviant maxdeviant deleted the marshall/gpui-restrict-scroll-to-axis branch March 3, 2025 22:32
JosephTLyons pushed a commit that referenced this pull request Mar 4, 2025
…25963)

This PR adds a new `restrict_scroll_to_axis` style to allow consumers to
opt-in to the scrolling behavior found on the web.

When this is enabled the behavior will be such that:

- Scrolling using the mouse wheel will only scroll the Y axis
- Scrolling using the mouse wheel with <kbd>Shift</kbd> held will only
scroll the X axis

This behavior is useful in scenarios where you have some
vertically-scrollable content that is interspersed with
horizontally-scrollable elements, as otherwise the scroll will be
constantly hijacked by the horizontally-scrollable elements while trying
to scroll up and down in the vertically-scrollable container.

I think that this behavior should be the default, but it's a bit of a
sweeping change to make all at once, so for now it remains opt-in.

Release Notes:

- N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant