From b02eabf67afe159b7850fdd5141da5f3ca68e3ef Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 15 Feb 2022 15:29:19 -0800 Subject: [PATCH 1/7] fix(android): nested frames were sometimes not recreated (#9748) Co-authored-by: Eduardo Speroni From 803553a6896d257b0874e1a393ec1641af197402 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 22 Feb 2022 18:04:11 -0800 Subject: [PATCH 2/7] feat: testID property for use with e2e testing without interfering with a11y --- packages/core/ui/core/view/index.android.ts | 6 +++++- packages/core/ui/core/view/index.ios.ts | 6 +++++- packages/core/ui/core/view/view-common.ts | 7 +++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts index c7a5933e01..b3bd6b5ff7 100644 --- a/packages/core/ui/core/view/index.android.ts +++ b/packages/core/ui/core/view/index.android.ts @@ -3,7 +3,7 @@ import type { Point, CustomLayoutView as CustomLayoutViewDefinition } from '.'; import type { GestureTypes, GestureEventData } from '../../gestures'; // Types. -import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty } from './view-common'; +import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty } from './view-common'; import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length } from '../../styling/style-properties'; import { layout } from '../../../utils'; import { Trace } from '../../../trace'; @@ -796,6 +796,10 @@ export class View extends ViewCommon { this.nativeViewProtected.setAlpha(float(value)); } + [testIDProperty.setNative](value: string) { + this.nativeViewProtected.setContentDescription(value); + } + [accessibilityEnabledProperty.setNative](value: boolean): void { this.nativeViewProtected.setFocusable(!!value); diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts index dfc05b5617..2d815d4c13 100644 --- a/packages/core/ui/core/view/index.ios.ts +++ b/packages/core/ui/core/view/index.ios.ts @@ -2,7 +2,7 @@ import { Point, View as ViewDefinition } from '.'; // Requires -import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty } from './view-common'; +import { ViewCommon, isEnabledProperty, originXProperty, originYProperty, isUserInteractionEnabledProperty, testIDProperty } from './view-common'; import { ShowModalOptions, hiddenProperty } from '../view-base'; import { Trace } from '../../../trace'; import { layout, iOSNativeHelper } from '../../../utils'; @@ -572,6 +572,10 @@ export class View extends ViewCommon implements ViewDefinition { this.updateOriginPoint(this.originX, value); } + [testIDProperty.setNative](value: string) { + this.nativeViewProtected.accessibilityIdentifier = value; + } + [accessibilityEnabledProperty.setNative](value: boolean): void { this.nativeViewProtected.isAccessibilityElement = !!value; diff --git a/packages/core/ui/core/view/view-common.ts b/packages/core/ui/core/view/view-common.ts index cce5a3838d..18bdc67db6 100644 --- a/packages/core/ui/core/view/view-common.ts +++ b/packages/core/ui/core/view/view-common.ts @@ -82,6 +82,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { public accessibilityValue: string; public accessibilityHint: string; + public testID: string; + public touchAnimation: boolean | TouchAnimationOptions; public ignoreTouchAnimation: boolean; @@ -1196,6 +1198,11 @@ const ignoreTouchAnimationProperty = new Property({ }); ignoreTouchAnimationProperty.register(ViewCommon); +export const testIDProperty = new Property({ + name: 'testID', +}); +testIDProperty.register(ViewCommon); + accessibilityIdentifierProperty.register(ViewCommon); accessibilityLabelProperty.register(ViewCommon); accessibilityValueProperty.register(ViewCommon); From f0ba44e7201c5eba86239884b62771177c4516c6 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Thu, 3 Mar 2022 21:29:08 +0100 Subject: [PATCH 3/7] feat: better testID support along a11y wip --- apps/toolbox/src/pages/a11y.xml | 24 ++++++++--------- packages/core/accessibility/index.android.ts | 4 ++- packages/core/global-types.d.ts | 1 + packages/core/ui/core/view/index.android.ts | 27 ++++++++++++++++---- packages/core/ui/core/view/index.ios.ts | 15 +++++++++-- packages/core/ui/core/view/view-common.ts | 4 +++ packages/core/ui/text-base/index.android.ts | 19 ++++++++++---- 7 files changed, 69 insertions(+), 25 deletions(-) diff --git a/apps/toolbox/src/pages/a11y.xml b/apps/toolbox/src/pages/a11y.xml index 1cf0298045..d8c62cb364 100644 --- a/apps/toolbox/src/pages/a11y.xml +++ b/apps/toolbox/src/pages/a11y.xml @@ -7,25 +7,25 @@ -