Skip to content

Conversation

@FrancoisBlavoet
Copy link

@FrancoisBlavoet FrancoisBlavoet commented Sep 8, 2025

Ugly fix for #2093

The current approach to check for modifier == Modifier.alpha(0f) only works if you use this exact modifier.
In particular, Modifier.graphicsLayer { alpha = 0f } won't match this check.

Unfortunately, Compose does not really expose anything that we could use to identify a transparent node.
There is however an internal function allowing us to detect this.
Ideally we would get the compose team to make it public (or otherwise expose this information another way), but in the mean time I have written this ugly reflective way to access this information

This also adds a check for HideFromAccessibility since this is a new replacement for InvisibleToUser, we need to check for that one too.

@FrancoisBlavoet FrancoisBlavoet changed the title Make it so Paparazzi A11y renderer correctly discards all nodes with … Make it so Paparazzi A11y renderer correctly discards all nodes with alpha=0f Sep 8, 2025
private fun SemanticsNode.hasZeroAlpha(): Boolean {
// try to reflectively query internal SemanticsNode.isTransparent() by iterating on kotlin field mangled names:
val candidateGetterNames = arrayOf(
"isTransparent",
Copy link
Author

@FrancoisBlavoet FrancoisBlavoet Sep 8, 2025

Choose a reason for hiding this comment

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

This is very ugly, unless there is an alternative way to get this info, we should get Compose to expose this property

@FrancoisBlavoet FrancoisBlavoet changed the title Make it so Paparazzi A11y renderer correctly discards all nodes with alpha=0f Paparazzi A11y renderer: discard all nodes with alpha=0f Sep 9, 2025
@FrancoisBlavoet FrancoisBlavoet changed the title Paparazzi A11y renderer: discard all nodes with alpha=0f A11y renderer: handle nodes with alpha=0f or HideFromAccessibility Sep 15, 2025
Copy link
Author

@FrancoisBlavoet FrancoisBlavoet Jan 12, 2026

Choose a reason for hiding this comment

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

this dropdown is detected as transparent. That's not ideal, but the "before" screenshot is also incorrect and does not display the dropdown content, so the after is technically correct.

This happens because DropdownMenu is a Popup and AFAIK paparazzi can only render content in the main window
The ideal state would be to display both windows, but that's out of the scope of this PR.

@FrancoisBlavoet
Copy link
Author

@TWiStErRob no hurry, but could I get another review on this? Ideally, if that PR looks good, then it would be nice to get it included in alpha3 🙏

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