Skip to content

Conversation

@m-sasha
Copy link

@m-sasha m-sasha commented Nov 18, 2025

To allow specifying AccessibleRoles with no corresponding Compose role, add SemanticsPropertyReceiver.awtRole.

Fixes https://youtrack.jetbrains.com/issue/CMP-9296/Support-specifying-AWT-AccessibleRole-in-semantics

Testing

Added a unit test, and tested manually with

@OptIn(ExperimentalComposeUiApi::class)
fun main() = singleWindowApplication {
    Box(
        modifier = Modifier
            .padding(16.dp)
            .clip(RoundedCornerShape(10.dp))
            .background(Color.Blue)
            .semantics(mergeDescendants = true) {
                awtRole = AccessibleRole.PUSH_BUTTON
            }
            .clickable {
                println("Clicked!")
            }
            .padding(horizontal = 16.dp, vertical = 8.dp),
        contentAlignment = Alignment.Center
    ) {
        Text("Click me", color = Color.White)
    }
}

This should be tested by QA

Release Notes

Features - Desktop

  • Allow specifying AWT AccessibleRole directly via SemanticsPropertyReceiver.awtRole.

@m-sasha m-sasha requested a review from igordmn November 18, 2025 13:18
@MatkovIvan MatkovIvan changed the title Allow specifying AWT AccessibleRole directly. Allow specifying AWT AccessibleRole directly Nov 18, 2025
Copy link
Collaborator

@igordmn igordmn left a comment

Choose a reason for hiding this comment

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

LGTM, but we need to wait for 1.10 branch.

Also needs 2 approvals.

*
* @see SemanticsPropertyReceiver.role
*/
@ExperimentalComposeUiApi
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, create an issue for removing experimental with target = 1.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants