feat(core): first class a11y support (#8909)

This commit is contained in:
Morten Sjøgren
2021-01-29 20:51:51 +01:00
committed by Nathan Walker
parent 577b1e9dad
commit f2e21a50a7
43 changed files with 2938 additions and 47 deletions

View File

@@ -7,6 +7,7 @@ import { PageBase, actionBarHiddenProperty, statusBarStyleProperty } from './pag
import { profile } from '../../profiling';
import { iOSNativeHelper, layout } from '../../utils';
import { getLastFocusedViewOnPage, isAccessibilityServiceEnabled } from '../../accessibility';
export * from './page-common';
@@ -522,6 +523,44 @@ export class Page extends PageBase {
}
}
}
public accessibilityScreenChanged(refocus = false): void {
if (!isAccessibilityServiceEnabled()) {
return;
}
if (refocus) {
const lastFocusedView = getLastFocusedViewOnPage(this);
if (lastFocusedView) {
const uiView = lastFocusedView.nativeViewProtected;
if (uiView) {
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, uiView);
return;
}
}
}
if (this.actionBarHidden) {
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, this.nativeViewProtected);
return;
}
if (this.accessibilityLabel) {
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, this.nativeViewProtected);
return;
}
if (this.actionBar.accessibilityLabel || this.actionBar.title) {
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, this.actionBar.nativeView);
return;
}
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, this.nativeViewProtected);
}
}
function invalidateTopmostController(controller: UIViewController): void {