mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(a11y): ios voiceover crash during touch (#9318)
closes https://github.com/NativeScript/NativeScript/issues/9317
This commit is contained in:
@@ -73,18 +73,18 @@ function ensureNativeClasses() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
nativeFocusedNotificationObserver = Application.ios.addNotificationObserver(UIAccessibilityElementFocusedNotification, (args: NSNotification) => {
|
nativeFocusedNotificationObserver = Application.ios.addNotificationObserver(UIAccessibilityElementFocusedNotification, (args: NSNotification) => {
|
||||||
const uiView = args.userInfo.objectForKey(UIAccessibilityFocusedElementKey) as UIView;
|
const uiView = args.userInfo?.objectForKey(UIAccessibilityFocusedElementKey) as UIView;
|
||||||
if (!uiView.tag) {
|
if (!uiView?.tag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootView = Application.getRootView();
|
const rootView = Application.getRootView();
|
||||||
|
|
||||||
// We use the UIView's tag to find the NativeScript View by its domId.
|
// We use the UIView's tag to find the NativeScript View by its domId.
|
||||||
let view = rootView.getViewByDomId<View>(uiView.tag);
|
let view = rootView.getViewByDomId<View>(uiView?.tag);
|
||||||
if (!view) {
|
if (!view) {
|
||||||
for (const modalView of <Array<View>>rootView._getRootModalViews()) {
|
for (const modalView of <Array<View>>rootView._getRootModalViews()) {
|
||||||
view = modalView.getViewByDomId(uiView.tag);
|
view = modalView.getViewByDomId(uiView?.tag);
|
||||||
if (view) {
|
if (view) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user