Skip to content

Fix a regression in scrolling when ComposeViewport is embedded in HTML scrollable container#3177

Open
Oleksandr Karpovich (eymar) wants to merge 6 commits into
jb-mainfrom
ok/fix_embedded_cmp_web_scrolling
Open

Fix a regression in scrolling when ComposeViewport is embedded in HTML scrollable container#3177
Oleksandr Karpovich (eymar) wants to merge 6 commits into
jb-mainfrom
ok/fix_embedded_cmp_web_scrolling

Conversation

@eymar

@eymar Oleksandr Karpovich (eymar) commented Jul 2, 2026

Copy link
Copy Markdown
Member

Fixes https://youtrack.jetbrains.com/issue/CMP-10351

Other changes:

  • changed the touchSlop from 18.dp to 8.dp to align with mobile platforms

Testing

Added 2 demos with embedded ComposeViewport.
The new demos available when passing an additional demo url parameter:

Release Notes

Fixes - Web

  • Fix a regression in scrolling when ComposeViewport is embedded in HTML scrollable container

…implify internal logic in `RootScrollObserver`
…nal`:

- Add `activeTouchPointersConsumedMoves` to track pointer moves consumed by Compose.
- Update `RootScrollObserver` to track total scroll events and refine `consumedAnyScroll` logic.
- Prevent browser override of touch gestures when no scrollable content is hit but some gestures are consumed by Compose.
- Minor adjustment to pointer change consumption in `PointerInputDebugOverlay`.
Comment thread compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/window/RootScrollObserver.kt Outdated
}

if (activeTouchPointers.isEmpty()) {
rootScrollObserver.reset()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would add here something like: require(activeTouchPointersConsumedMoves.isEmpty())

override val viewConfiguration =
object : ViewConfiguration by PlatformContext.DefaultViewConfiguration {
override val touchSlop: Float get() = with(density) { 18.dp.toPx() }
override val touchSlop: Float get() = with(density) { 8.dp.toPx() }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

installFallbackFontDownloader()
interopContainer.TrackInteropPlacementContainer {
content()
WithNestedScrollObserver(rootScrollObserver) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you explain how it is handled in android? (I mean a nested compose scollable into an android view scrollable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants