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

Support a11y for interop views #1241

Merged
merged 8 commits into from
Apr 5, 2024
Merged

Conversation

elijah-semyonov
Copy link

@elijah-semyonov elijah-semyonov commented Apr 5, 2024

Proposed Changes

Make the native views created using UIKitView and UIKitViewController reachable by AX services.

Testing

Test: NativeModalWithNavigation cats images are interop views reachable by using the VoiceOver controls.

Issues fixed

Fixes: JetBrains/compose-multiplatform#4290

Example

UIImageView focused by using the VoiceOver controls

drawing

@elijah-semyonov elijah-semyonov self-assigned this Apr 5, 2024

NS_ASSUME_NONNULL_BEGIN

@interface CMPInteropWrappingView : UIView
Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM, One thing to think about:
Creating new subclass of UIView / UIAccessibilityElement for every new use-case (which is now) VS create one subclass of UIView, one of UIAccessibilityElement with all default implementations of necessary methods from Accessibility protocols.

Copy link
Author

Choose a reason for hiding this comment

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

The whole point of this is to make the UIAccessibility methods be visible to Kotlin in the first place. Cinterop doesn't see some of them because they are declared in a category and struggles to do overriding because of duality of property and selectors in ObjC which is not the case for fields and methods in Kotlin. Keeping it in ObjC and avoiding presence of subclasses in Kotlin altogether would require adding a lot of code to ObjC to map the values and types from compose core. Thus I find the current solution the most optimal trade-off.

@elijah-semyonov elijah-semyonov merged commit 7c9aaa2 into jb-main Apr 5, 2024
6 checks passed
@elijah-semyonov elijah-semyonov deleted the es/a11y-native-interop branch April 5, 2024 19:12
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