# gpui: Add tab focus support \(\#33008\) · gitcafe/zed

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

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

Visibility: public

Requested revision: caa4b529e4b130006990a31b4908e4252aa96fe4

Requested commit: caa4b529e4b130006990a31b4908e4252aa96fe4

Commit: caa4b529e4b130006990a31b4908e4252aa96fe4

Tree: e300a33b7f3aade1164cc259049b2c618a55895b

Author: Jason Lee

Committer: GitHub

## Message

````
gpui: Add tab focus support (#33008)

Release Notes:

- N/A

With a `tab_index` and `tab_stop` option to `FocusHandle` to us can
switch focus by `Tab`, `Shift-Tab`.

The `tab_index` is from
[WinUI](https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.control.tabindex?view=winrt-26100)
and [HTML
tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex),
only the `tab_stop` is enabled that can be added into the `tab_handles`
list.

- Added `window.focus_next()` and `window.focus_previous()` method to
switch focus.
- Added `tab_index` to `InteractiveElement`.

```bash
cargo run -p gpui --example tab_stop
```


https://github.com/user-attachments/assets/ac4e3e49-8359-436c-9a6e-badba2225211
````

## Parents

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

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