Skip to content

Conversation

m-sasha
Copy link
Member

@m-sasha m-sasha commented Jun 29, 2025

Actually ignore semantics nodes marked as invisible for a11y; not just report them as invisible.

VoiceOver doesn't skip or ignore accessible components that return isVisible() = false.
This PR completely removes from the semantic tree nodes that are marked with hideFromAccessibility().

Slack discussion

Testing

Adjusted the unit test and also tested manually with VoiceOver with

    MaterialTheme {
        Column(
            modifier = Modifier
                .fillMaxSize()
        ) {
            repeat(10) {
                Row(
                    modifier = Modifier.fillMaxWidth()
                        .padding(vertical = 8.dp, horizontal = 16.dp)
                        .semantics(mergeDescendants = true) {
                            if (it % 2 == 1) {
                                hideFromAccessibility()
                            }
                        },
                    verticalAlignment = Alignment.CenterVertically,
                    horizontalArrangement = Arrangement.spacedBy(8.dp)
                ) {
                    Text("Hello $it")
                }
            }
        }
    }

This should be tested by QA

Release Notes

Fixes - Desktop

  • Elements marked with Modifier.semantics { hideFromAccessibility() } should now be correctly hidden from a11y.

@m-sasha m-sasha requested a review from igordmn June 29, 2025 13:46
@m-sasha m-sasha merged commit ee810e8 into jb-main Jul 1, 2025
10 checks passed
@m-sasha m-sasha deleted the m-sasha/ignore-nodes-invisible-to-a11y branch July 1, 2025 21:41
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