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

Platform layers clip popup shadows #4460

Closed
alexzhirkevich opened this issue Mar 10, 2024 · 4 comments · Fixed by JetBrains/compose-multiplatform-core#1190
Closed

Platform layers clip popup shadows #4460

alexzhirkevich opened this issue Mar 10, 2024 · 4 comments · Fixed by JetBrains/compose-multiplatform-core#1190
Assignees
Labels
bug Something isn't working ios layers: popup/dialog rendering Low level rendering

Comments

@alexzhirkevich
Copy link
Contributor

Affected platforms

  • iOS

Versions

  • Compose Multiplatform version*: 1.6.0

To Reproduce

Box(
    modifier = Modifier.fillMaxSize(),
    contentAlignment = Alignment.Center
) {
    Popup(alignment = Alignment.Center) {
        Box(
            Modifier
                .shadow(elevation = 32.dp, shape = RoundedCornerShape(16.dp))
                .background(Color.White)
                .clip(RoundedCornerShape(16.dp))
                .padding(50.dp)
        ) {
            Text("platformLayers = true")
        }
    }
}
@alexzhirkevich alexzhirkevich added bug Something isn't working submitted labels Mar 10, 2024
@MatkovIvan
Copy link
Member

MatkovIvan commented Mar 10, 2024

It's a known, documented limitation at the moment. See docs:

Note that popups and dialogs are still unable to draw anything out of their own bounds (for example, a shadow of the topmost container).

You can use old behaviour with platformLayers = false or wrap Popup's content into a bigger Box with padding as a workaround.

Since there was no issue about it on GitHub, let's keep it to track this

@alexzhirkevich
Copy link
Contributor Author

Is there any benefits of using platform layers in full-compose app?

@alexzhirkevich
Copy link
Contributor Author

alexzhirkevich commented Mar 10, 2024

documented limitation at the moment

May be this should've been mentioned in the Breaking Changes section as it is set by default and kinda breaks popups that've been working before

@MatkovIvan MatkovIvan self-assigned this Mar 10, 2024
@MatkovIvan
Copy link
Member

Is there any benefits of using platform layers in full-compose app?

A new way is generally a more correct approach - Compose was designed there in a way to bind each layout node root to a separate platform view. In the case of a full-screen compose app - set of our old hacks should work fine. However, it might affect things like more correct a11y binding etc.

We're considering platformLayers = false as a temporal flag, so I encourage you to not consider it as a long-term solution

May be this should've been mentioned in the Breaking Changes section

The limitation itself shouldn't be in "Breaking Changes" - we'll fix it in future releases (already have some draft), but probably the point about platformLayers should have different wording. Anyway, thanks for this note, we'll reconsider this part.

MatkovIvan added a commit to JetBrains/compose-multiplatform-core that referenced this issue Mar 22, 2024
## Proposed Changes

- Use skia's BBHFactory to track real drawing bounds - requires
JetBrains/skiko#889 (skiko `0.7.98`)
- Adding additional click filtering to handle clicks on "shadow" area as
click outside

## Testing

Test: Try to use new platform layers with shadows

<img width="695" alt="image"
src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/80dce85f-814d-4d51-ab5e-6535ed976d48">

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#4460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios layers: popup/dialog rendering Low level rendering
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants