diff --git a/packages/core/accessibility/accessibility-properties.ts b/packages/core/accessibility/accessibility-properties.ts index 9c77654198..96d99df747 100644 --- a/packages/core/accessibility/accessibility-properties.ts +++ b/packages/core/accessibility/accessibility-properties.ts @@ -26,7 +26,6 @@ function makePropertyEnumConverter(enumValues) { export const accessibilityEnabledProperty = new CssProperty({ name: 'accessible', - defaultValue: true, cssName: 'a11y-enabled', valueConverter: booleanConverter, }); diff --git a/packages/core/ui/core/view-base/index.ts b/packages/core/ui/core/view-base/index.ts index daab36d9e7..8da0a79b48 100644 --- a/packages/core/ui/core/view-base/index.ts +++ b/packages/core/ui/core/view-base/index.ts @@ -2,6 +2,7 @@ import { AlignSelf, FlexGrow, FlexShrink, FlexWrapBefore, Order } from '../../la import { Page } from '../../page'; import { CoreTypes } from '../../../core-types'; import { Property, CssProperty, CssAnimationProperty, InheritedProperty, clearInheritedProperties, propagateInheritableProperties, propagateInheritableCssProperties, initNativeView } from '../properties'; +import { setupAccessibleView } from '../../../accessibility'; import { CSSUtils } from '../../../css/system-classes'; import { Source } from '../../../utils/debug'; import { Binding, BindingOptions } from '../bindable'; @@ -598,6 +599,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition return true; }); + setupAccessibleView(this); this._emit('loaded'); } diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts index ce539ea2e6..41758446ff 100644 --- a/packages/core/ui/core/view/index.android.ts +++ b/packages/core/ui/core/view/index.android.ts @@ -826,9 +826,8 @@ export class View extends ViewCommon { [accessibilityEnabledProperty.setNative](value: boolean): void { this.nativeViewProtected.setFocusable(!!value); - if (value) { - updateAccessibilityProperties(this); - } + + updateAccessibilityProperties(this); } [accessibilityIdentifierProperty.setNative](value: string): void { @@ -1264,15 +1263,6 @@ export class View extends ViewCommon { export class ContainerView extends View { public iosOverflowSafeArea: boolean; - - constructor() { - super(); - /** - * mark accessible as false without triggering proerty change - * equivalent to changing the default - */ - this.style[accessibilityEnabledProperty.key] = false; - } } export class CustomLayoutView extends ContainerView implements CustomLayoutViewDefinition { diff --git a/packages/core/ui/core/view/index.d.ts b/packages/core/ui/core/view/index.d.ts index 06d21abe73..c462b8e1c2 100644 --- a/packages/core/ui/core/view/index.d.ts +++ b/packages/core/ui/core/view/index.d.ts @@ -228,6 +228,11 @@ export abstract class View extends ViewCommon { */ color: Color; + /** + * If `true` the element is an accessibility element and all the children will be treated as a single selectable component. + */ + accessible: boolean; + /** * Hide the view and its children from the a11y service */ diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts index da7ac4ef48..9aef26068d 100644 --- a/packages/core/ui/core/view/index.ios.ts +++ b/packages/core/ui/core/view/index.ios.ts @@ -683,9 +683,8 @@ export class View extends ViewCommon implements ViewDefinition { [accessibilityEnabledProperty.setNative](value: boolean): void { this.nativeViewProtected.isAccessibilityElement = !!value; - if (value) { - updateAccessibilityProperties(this); - } + + updateAccessibilityProperties(this); } [accessibilityIdentifierProperty.getDefault](): string { @@ -1069,11 +1068,6 @@ export class ContainerView extends View { constructor() { super(); this.iosOverflowSafeArea = true; - /** - * mark accessible as false without triggering proerty change - * equivalent to changing the default - */ - this.style[accessibilityEnabledProperty.key] = false; } } diff --git a/packages/core/ui/core/view/view-common.ts b/packages/core/ui/core/view/view-common.ts index f03025fe84..b19442d0f2 100644 --- a/packages/core/ui/core/view/view-common.ts +++ b/packages/core/ui/core/view/view-common.ts @@ -12,7 +12,6 @@ import { EventData } from '../../../data/observable'; import { Trace } from '../../../trace'; import { CoreTypes } from '../../../core-types'; import { ViewHelper } from './view-helper'; -import { setupAccessibleView } from '../../../accessibility'; import { PercentLength } from '../../styling/style-properties'; @@ -191,9 +190,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { } } super.onLoaded(); - if (this.accessible) { - setupAccessibleView(this); - } } public _closeAllModalViewsInternal(): boolean { @@ -827,9 +823,11 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { get accessible(): boolean { return this.style.accessible; + // return this._accessible; } set accessible(value: boolean) { this.style.accessible = value; + // this._accessible = value; } get accessibilityHidden(): boolean {