mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(core): first class a11y support (#8909)
This commit is contained in:
committed by
Nathan Walker
parent
577b1e9dad
commit
f2e21a50a7
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user