# gpui: Add \`restrict_scroll_to_axis\` to match web scrolling behavior \(\#25963\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/7321c814ced25ad70eceb1f345575ea71f9b487b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 7321c814ced25ad70eceb1f345575ea71f9b487b

Requested commit: 7321c814ced25ad70eceb1f345575ea71f9b487b

Commit: 7321c814ced25ad70eceb1f345575ea71f9b487b

Tree: 90d95b1579681cfcbfd188a9744467438e2b9cc2

Author: Marshall Bowers

Committer: GitHub

## Message

```
gpui: Add `restrict_scroll_to_axis` to match web scrolling behavior (#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
```

## Parents

- [ac3cb3df05807731e4eec46806579659ccb4d826](https://git.cafe/gitcafe/zed/commit/ac3cb3df05807731e4eec46806579659ccb4d826?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/7321c814ced25ad70eceb1f345575ea71f9b487b?format=markdown)
