# Introduce autoscroll support for elements \(\#10889\) · gitcafe/zed

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

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

Visibility: public

Requested revision: bcbf2f2fd372fe8715385bdce8f272014f2f2510

Requested commit: bcbf2f2fd372fe8715385bdce8f272014f2f2510

Commit: bcbf2f2fd372fe8715385bdce8f272014f2f2510

Tree: aab7f3d7fe2c050acbe67eb20365c4c1271c09b1

Author: Antonio Scandurra

Committer: GitHub

## Message

```
Introduce autoscroll support for elements (#10889)

This pull request introduces the new
`ElementContext::request_autoscroll(bounds)` and
`ElementContext::take_autoscroll()` methods in GPUI. These new APIs
enable container elements such as `List` to change their scroll position
if one of their children requested an autoscroll. We plan to use this in
the revamped assistant.

As a drive-by, we also:

- Renamed `Element::before_layout` to `Element::request_layout`
- Renamed `Element::after_layout` to `Element::prepaint`
- Introduced a new `List::splice_focusable` method to splice focusable
elements into the list, which enables rendering offscreen elements that
are focused.

Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
```

## Parents

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

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