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

Opt-in a11y argument for iOS interop #1350

Merged
merged 3 commits into from
May 10, 2024

Conversation

elijah-semyonov
Copy link

@elijah-semyonov elijah-semyonov commented May 8, 2024

It's non-trivial to figure out if the UIKit content has any accessibility element in its subtree in a general case. In the same time interop UIViews can taint the tree of SemanticsModifierNode merging its children and redirecting all accessibility input to interop UIView, missing all other data. This lead to unexpected situations, where Compose controls were inaccessible because they contained a native UIKit element inside.

Add accesibilityEnabled argument to UIKitView/UIKitViewController APIs
Don't set interopView semantics property unless accesibilityEnabled is true.
Document the interaction thoroughly.

Testing

  • InteropViewAndSemanticsConfigMerge: first button is not tainted by UIKitView content and is possible to interact via a11y input.

Release Notes

Features - iOS

  • Added source-compatible accessibilityEnabled: Boolean = true argument to UIKitView and UIKitViewController.

Note

Additive API changes consequences are unclear for Kotlin/Native source sets. Should we do overloads with extra parameters as well? cc @igordmn

@@ -112,6 +142,7 @@ fun <T : UIView> UIKitView(
onRelease: (T) -> Unit = STUB_CALLBACK_WITH_RECEIVER,
onResize: (view: T, rect: CValue<CGRect>) -> Unit = DefaultViewResize,
interactive: Boolean = true,
accessibilityEnabled: Boolean = true,
Copy link
Member

Choose a reason for hiding this comment

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

@igordmn Do you know if it's a compatible change for K/N?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know, but we don't guarantee compatibility until iOS Release.

Also, we need to enable binary validator for native before that.

@elijah-semyonov elijah-semyonov marked this pull request as ready for review May 10, 2024 07:05
@elijah-semyonov elijah-semyonov merged commit 0f2c1b6 into jb-main May 10, 2024
6 checks passed
@elijah-semyonov elijah-semyonov deleted the es/opt-in-accessibility-for-interop branch May 10, 2024 07:06
MatkovIvan added a commit that referenced this pull request May 22, 2024
Fix regression after #1350

Before | After
---|---
![Simulator Screenshot - iPhone 15 Plus - 2024-05-22 at 13 03
14](https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/533b0841-1518-4b34-8427-56bdf9fff3b8)
| ![Simulator Screenshot - iPhone 15 Plus - 2024-05-22 at 12 58
33](https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/6a5d554f-d132-4c30-9488-8b027549b15b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants