Skip to content

revert: "perf: disable accessibility for layout views (#10482)" #10517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/core/accessibility/accessibility-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function makePropertyEnumConverter<T>(enumValues) {

export const accessibilityEnabledProperty = new CssProperty<Style, boolean>({
name: 'accessible',
defaultValue: true,
cssName: 'a11y-enabled',
valueConverter: booleanConverter,
});
Expand Down
2 changes: 2 additions & 0 deletions packages/core/ui/core/view-base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -598,6 +599,7 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition

return true;
});
setupAccessibleView(<any>this);

this._emit('loaded');
}
Expand Down
14 changes: 2 additions & 12 deletions packages/core/ui/core/view/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions packages/core/ui/core/view/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
10 changes: 2 additions & 8 deletions packages/core/ui/core/view/index.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
}

Expand Down
6 changes: 2 additions & 4 deletions packages/core/ui/core/view/view-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -191,9 +190,6 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
}
super.onLoaded();
if (this.accessible) {
setupAccessibleView(this);
}
}

public _closeAllModalViewsInternal(): boolean {
Expand Down Expand Up @@ -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 {
Expand Down
Loading