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

Accessibility. Crash on Windows when traversing elements #4778

Open
igordmn opened this issue May 8, 2024 · 2 comments
Open

Accessibility. Crash on Windows when traversing elements #4778

igordmn opened this issue May 8, 2024 · 2 comments
Assignees
Labels
accessibility bug Something isn't working windows

Comments

@igordmn
Copy link
Collaborator

igordmn commented May 8, 2024

Compose 1.6.10-rc01, Windows 11, NVDA 2023.2

  1. run run1
  2. traverse with hot keys
  3. see crash:
Caused by: java.lang.IndexOutOfBoundsException: index: -3, size: 1
	at kotlin.collections.AbstractList$Companion.checkElementIndex$kotlin_stdlib(AbstractList.kt:108)
	at kotlin.collections.builders.ListBuilder.get(ListBuilder.kt:59)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleChild(ComposeAccessible.kt:337)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:380)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:381)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:381)
	at androidx.compose.ui.platform.a11y.ComposeSceneAccessible$ComposeSceneAccessibleContext.getAccessibleAt(ComposeSceneAccessible.kt:89)
	at jdk.accessibility/com.sun.java.accessibility.util.EventQueueMonitor.getAccessibleAt(EventQueueMonitor.java:441)
	at jdk.accessibility/com.sun.java.accessibility.internal.AccessBridge$12.call(AccessBridge.java:581)
	at jdk.accessibility/com.sun.java.accessibility.internal.AccessBridge$12.call(AccessBridge.java:578)
	at jdk.accessibility/com.sun.java.accessibility.internal.AccessBridge$InvocationUtils$CallableWrapper.run(AccessBridge.java:7334)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
@igordmn igordmn added bug Something isn't working windows accessibility labels May 8, 2024
@igordmn igordmn changed the title Accesibility. Crash on Windows when traversing elements. Accesibility. Crash on Windows when traversing elements May 8, 2024
@igordmn igordmn changed the title Accesibility. Crash on Windows when traversing elements Accessibility. Crash on Windows when traversing elements May 8, 2024
@mgroth0
Copy link

mgroth0 commented May 28, 2024

Something like this is occurring for me as well on Desktop.

I am running:

  • MacOS 14.5
  • Java 20
  • Kotlin 2.0.0-RC1
  • Compose 1.6.10
Click here to see stack trace

java.lang.IndexOutOfBoundsException: index: -707, size: 1
	at kotlin.collections.AbstractList$Companion.checkElementIndex$kotlin_stdlib(AbstractList.kt:108)
	at kotlin.collections.builders.ListBuilder.get(ListBuilder.kt:39)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleChild(ComposeAccessible.kt:337)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:380)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:381)
	at androidx.compose.ui.platform.a11y.ComposeSceneAccessible$ComposeSceneAccessibleContext.getAccessibleAt(ComposeSceneAccessible.kt:89)
	at java.desktop/sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:501)
	at java.desktop/sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:471)
	at java.desktop/sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:701)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.executePrivileged(AccessController.java:778)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.base/java.security.AccessController.executePrivileged(AccessController.java:778)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
	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)

I first started seeing this after putting together a complex UI with a very large amount of code behind it (this was also shortly after updating to 1.6.10). I expect it will take me a while to extract out a reproducer. I can, however, easily reproduce the issue in my own app. It is non-deterministic; I have to try the same thing a few times before the exception is thrown.

@mgroth0
Copy link

mgroth0 commented May 28, 2024

Well, I was totally wrong about this being hard to reproduce. It was actually fast and easy.

Reproducer:

  1. Launch app
  2. Hover mouse above one of the "world" texts
  3. Scroll down
  4. Move mouse to the right, above the empty space
  5. Click
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Text
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application

fun main() {
    application {
        Window(
            onCloseRequest = ::exitApplication
        ) {
            LazyColumn {
                item {
                    Text("Hello")
                }
                item {
                    repeat(100) {
                        Text("World")
                    }
                }
            }
        }
    }
}
Click here to see stack trace

java.lang.IndexOutOfBoundsException: index: -1, size: 1
	at kotlin.collections.AbstractList$Companion.checkElementIndex$kotlin_stdlib(AbstractList.kt:108)
	at kotlin.collections.builders.ListBuilder.get(ListBuilder.kt:39)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleChild(ComposeAccessible.kt:337)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:380)
	at androidx.compose.ui.platform.a11y.ComposeAccessible$ComposeAccessibleComponent.getAccessibleAt(ComposeAccessible.kt:381)
	at androidx.compose.ui.platform.a11y.ComposeSceneAccessible$ComposeSceneAccessibleContext.getAccessibleAt(ComposeSceneAccessible.kt:89)
	at java.desktop/sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:501)
	at java.desktop/sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:471)
	at java.desktop/sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:701)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.executePrivileged(AccessController.java:778)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.base/java.security.AccessController.executePrivileged(AccessController.java:778)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
	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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility bug Something isn't working windows
Projects
None yet
Development

No branches or pull requests

3 participants