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

Workaround a11y issue with popups #792

Merged
merged 1 commit into from Sep 6, 2023
Merged

Conversation

Walingar
Copy link
Collaborator

@Walingar Walingar commented Sep 5, 2023

Proposed Changes

  • Add native initialization of ComposeAccessible that will create the proper mapping between ComposeAccessbile and ComposeAccessibleComponent on MacOs

See related PR in skiko: JetBrains/skiko#793

Testing

Test: a11y can be tested only manually for now

Reproducer:

  1. Enable VoiceOver.
  2. Open Menu with ctrl+option+space
  3. Navigate to "click me" with Tab
  4. Try to press it with ctrl+option+space
fun main() = singleWindowApplication {
    Column {
        var expanded by remember { mutableStateOf(false) }
        Column {
            Text(
                text = "Menu",
                modifier = Modifier.background(Color.Cyan)
                    .clickable(role = Role.Button, onClick = {
                        expanded = !expanded
                    })
            )
        }
        if (expanded) {
            Popup(
                popupPositionProvider = rememberComponentRectPositionProvider(),
                onDismissRequest = { expanded = false },
                focusable = true
            ) {
                Column {
                    Text(
                        text = "click me",
                        modifier = Modifier.clickable(
                            role = Role.Button,
                            onClick = { println("Click") })
                    )
                }
            }
        }
    }
}

Before the fix crash will occur:

Exception in thread “AWT-EventQueue-0” java.lang.IncompatibleClassChangeError: Class androidx.compose.ui.platform.ComposeSceneAccessible$ComposeSceneAccessibleContext does not implement the requested interface javax.accessibility.AccessibleAction
	at java.desktop/sun.lwawt.macosx.CAccessibility$3.run(CAccessibility.java:162)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

… between ComposeAccessibleComponent and ComposeAccessible is built
@Walingar Walingar merged commit 6cb3be8 into jb-main Sep 6, 2023
3 checks passed
@Walingar Walingar deleted the nr/accessibility-fix branch September 6, 2023 10:06
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