Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import androidx.compose.ui.layout.MeasureResult
import androidx.compose.ui.layout.MeasureScope
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.popup
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntRect
import androidx.compose.ui.unit.IntSize
Expand Down Expand Up @@ -166,7 +166,6 @@ private fun JPopupImpl(
blendingEnabled: Boolean,
content: @Composable () -> Unit,
) {
val popupDensity = LocalDensity.current
val component = LocalComponent.current

val currentContent by rememberUpdatedState(content)
Expand Down Expand Up @@ -252,7 +251,10 @@ private fun JPopupImpl(
JBR.getRoundedCornersManager()
.setRoundedCorners(
dialog,
cornerSize.toPx(size.toSize(), popupDensity) / dialog.density(),
cornerSize.toPx(
size.toSize(),
Density(dialog.density()),
) / dialog.density(),
)
}
}
Expand All @@ -270,7 +272,7 @@ private fun JPopupImpl(

val rectValue = popupRectangle
LaunchedEffect(rectValue) {
val rectangle = rectValue?.withDensity(popupDensity.density) ?: return@LaunchedEffect
val rectangle = rectValue?.withDensity(dialog.density()) ?: return@LaunchedEffect
dialog.size = rectangle.size
dialog.location = rectangle.location.fromCurrentScreenToGlobal(window)
}
Expand Down Expand Up @@ -419,7 +421,7 @@ private fun Rectangle.withDensity(density: Float): Rectangle =
@Composable
private fun ProvideValuesFromOtherContext(context: CompositionLocalContext, content: @Composable () -> Unit) {
val existingContext = currentCompositionLocalContext
CompositionLocalProvider(context) { CompositionLocalProvider(existingContext, content) }
CompositionLocalProvider(existingContext) { CompositionLocalProvider(context, content) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I found an issue connected to this change, pls correct me if I'm wrong
If I enable Custom Popup Renderer and try to open Sub menus, it just disappears and i cannot open further submenus. Video is attached.
When I revert your change, it works fine.
After some discussion with AI, he told me that "a submenu is itself another popup, opened from inside the first popup, and for that nested popup to appear correctly, the submenu code must see the current popup host component, but because of the change it sees the original parent window component." Does it make any sense? 😄

Screen.Recording.2026-04-08.at.15.26.49.mov

}

/** Returns the screen density of the component's current monitor. */
Expand Down
Loading