Skip to content

Conversation

@svastven
Copy link

@svastven svastven commented Jan 6, 2026

This PR fixes an issue where window insets (like statusBarsPadding()) did not correctly respect or propagate consumed window insets. The core problem was that the InsetsPaddingModifierNode logic was "hidden" from the layout traversal system because it was implemented via delegation.

The Modifier.windowInsetsPadding now applies two separate modifiers which create nodes of two types:

  • PlatformInsetsPaddingModifierNode is an InsetsPaddingModifierNode that handles actual layout padding and correct resolve of window insets consumed by ancestors.
  • PlatformWindowInsetsPaddingModifierNode is responsible for retrieving platform-specific WindowInsets values. On attachment, it traverses up the modifier chain to find the ancestor PlatformInsetsPaddingModifierNode and establishes a link. It provides the insets back up to this ancestor node.

Fixes CMP-9390 iOS seems to ignore consumeWindowInsets

Testing

Adds skiko tests to WindowInsetsTest

This should be tested by QA

Release Notes

Fixes - Multiple Platforms

  • Fix window insets consumption in system window insets padding modifiers.

@svastven svastven self-assigned this Jan 6, 2026
@svastven svastven changed the title Svastven/consume window insets Fix consuming window insets in system window insets padding Jan 6, 2026
@svastven svastven removed their assignment Jan 6, 2026
insetsCalculation: PlatformWindowInsets.() -> WindowInsets,
): Modifier = this then
PlatformInsetsPaddingModifierElement(inspectorInfo) then
PlatformWindowInsetsPaddingModifierElement(inspectorInfo, insetsCalculation)
Copy link
Member

Choose a reason for hiding this comment

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

Adding both of them works, but kind of suspicious and creates more elements to allocate/iterate/etc 🤔

Just to be informed: what's about these alternatives?

  1. Delegate PlatformWindowInsetsProviderNode from InsetsPaddingModifierNode (not visa versa).
  2. Using DelegatableNode.visitAncestors(includeDelegates = true)

(1) looks more promising for me. WDYT?

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.

3 participants