# gpui: Fix broken rendering with nested opacity \(\#35407\) · gitcafe/zed

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

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

Visibility: public

Requested revision: d6becab3be532fa32323e3b03681a164a0bca101

Requested commit: d6becab3be532fa32323e3b03681a164a0bca101

Commit: d6becab3be532fa32323e3b03681a164a0bca101

Tree: 6ac49a7e25d03398be7db22041d1e62d56b74683

Author: Cyandev

Committer: GitHub

## Message

````
gpui: Fix broken rendering with nested opacity (#35407)

Rendering breaks when both an element and its parent have opacity set.
The following code reproduces the issue:

```rust
struct Repro;

impl Render for Repro {
    fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
        fn make_box(bg: impl Into<Fill>) -> impl IntoElement {
            div().size_8().bg(bg).hover(|style| style.opacity(0.5))
        }

        div()
            .flex()
            .items_center()
            .justify_center()
            .size(px(500.0))
            .hover(|style| style.opacity(0.5))
            .child(make_box(gpui::red()))
            .child(make_box(gpui::green()))
            .child(make_box(gpui::blue()))
    }
}
```

Before (broken behavior):


https://github.com/user-attachments/assets/2c5c1e31-88b2-4f39-81f8-40060e3fe958

The child element resets its parent and siblings' opacity, which is an
unexpected behavior.

After (fixed behavior):


https://github.com/user-attachments/assets/48527033-b06f-4737-b6c3-0ee3d133f138

Release Notes:

- Fixed an issue where nested opacity is rendered incorrectly.
````

## Parents

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

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