Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync all AccessibilityControllers when an a11y query is received. #1283

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

m-sasha
Copy link

@m-sasha m-sasha commented Apr 18, 2024

In commit 0367360, the syncing of AccessibilityControllers was broken by changing the lastUseTime property from being global to being local to an AccessibilityController. This resulted in a newly created AccessibilityController (e.g. for a Popup) not syncing immediately, essentially making its contents invisible to the OS's a11y.

RelNode: Fix syncing of AccessibilityController to correctly expose Dialog/Popup/DropdownMenu contents to the OS's a11y system.

Proposed Changes

Make the accessibility lastUseTime flag global again, and correctly sync all live AccessibilityControllers when it is modified.

Testing

Tested manually with this:

fun main() = singleWindowApplication {
    var menuOpenState by remember { mutableStateOf(false) }
    Text("Menu", Modifier.semantics { role = Role.Button }.clickable { menuOpenState = !menuOpenState })
    DropdownMenu(
        expanded = menuOpenState,
        onDismissRequest = { menuOpenState = false },
        properties = PopupProperties(focusable = true)
    ) {
        DropdownMenuItem(onClick = {}) { Text("Menu item 1") }
        DropdownMenuItem(onClick = {}) { Text("Menu item 2") }
        DropdownMenuItem(onClick = {}) { Text("Menu item 3") }
    }
}

Unfortunately I couldn't make a working unit test for this because the querying itself (of accessibles) on an AccessibleController causes it to sync. A Heisenberg's accessible.

Issues Fixed

Fixes: https://youtrack.jetbrains.com/issue/COMPOSE-1303/VoiceOver-doesnt-read-DropDown-menu

@elijah-semyonov
Copy link

@m-sasha
Looks OK, but tests disagree

@m-sasha
Copy link
Author

m-sasha commented Apr 18, 2024

The tests were wrong.

@m-sasha m-sasha merged commit dd22ec6 into jb-main Apr 18, 2024
6 checks passed
@m-sasha m-sasha deleted the m-sasha/fix-a11y-controller-sync branch April 18, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants