TextureGroup / Texture

Smooth asynchronous user interfaces for iOS apps.
https://texturegroup.org/
Other
8.02k stars 1.29k forks source link

Accessibility when UITextField floating above ASTableView #2048

Closed onato closed 2 years ago

onato commented 2 years ago

I have a floating UI element that is built with UIKit. It is in an ASDKViewController added to the view. Currently, it is not accessible because Texture seems to be managing the accessibility elements and is not expecting this use case. I'm looking for the expected and supported way to implement this.

Screen Shot 2021-12-03 at 1 13 15 PM

If the UITextView has no Texture element underneath, it is accessible.

This also works with a UITableView under the UITextView.

Screen Shot 2021-12-03 at 1 22 23 PM

When I add an ASTableView, the UITextView becomes inaccessable.

Screen Shot 2021-12-03 at 1 23 12 PM

I have created a minimal example. I would like the UITextField in ViewController.swift to be accessible with the Accessibility Inspector.

XibTest.zip

onato commented 2 years ago

I managed to get it to work with a dirty hack. I replaced the root node with this one and added my UIView subclass to additionalViews.

Is there a cleaner/supported way to do this?

class AccessableDisplayNode: ASDisplayNode {
    var additionalViews: [UIView] = []
    override var accessibilityElements: [Any]? {
        get {
            (super.accessibilityElements ?? []) + additionalViews
        }
        set {
            super.accessibilityElements = newValue
        }
    }
}