Hi Jono,
I spent some time looking into the code of the WebView plugin and found out why the screen reader does not see it: it is because on iOS, we overwrite the native accessibility hierarchy, and the WebView is not included in it.
A workaround solution might involve changing the code of the plugin to do the opposite: when a WebView is initialized, it overwrites the native accessibility hierarchy by replacing its contents with itself:
// plugins/iOS/WebView.mm
- (id)initWithGameObjectName:...
{
...
UIView *view = UnityGetGLViewController().view;
...
[view addSubview:webView];
view.accessibilityElements = @[webView]; // workaround
return self;
}
This will make the WebView and its content visible to the screen reader. However, this solution would only work for cases where the WebView is presented fullscreen.
It should be possible to write a solution that inserts the WebView into the accessibility hierarchy without overwriting it, which should look like this:
// plugins/iOS/WebView.mm
- (id)initWithGameObjectName:...
{
...
NSMutableArray<UIAccessibilityElement *> *accessibilityElements = view.accessibilityElements ?
[view.accessibilityElements mutableCopy] : [NSMutableArray array];
[accessibilityElements addObject: (UIAccessibilityElement *)webView]; // adds the WebView at the end of the accessibility hierarchy
view.accessibilityElements = accessibilityElements;
return self;
}
When the WebView is disposed, it should be removed from the native accessibility hierarchy:
// plugins/iOS/WebView.mm
- (void)dispose
{
if (webView != nil) {
...
NSMutableArray<UIAccessibilityElement *> *accessibilityElements = view.accessibilityElements ?
[view.accessibilityElements mutableCopy] : [NSMutableArray array];
[accessibilityElements removeObject: (UIAccessibilityElement *)webView];
view.accessibilityElements = accessibilityElements;
}
...
}
Of course, it might be better to add and remove the WebView when it is shown and hidden than when it is initialized and disposed.
On Android, the WebView should be accessible without any changes to Unity or WebView code because the accessibility hierarchy works differently than on iOS.
Let me know if this works! 