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

This commit is contained in:
Dimitris-Rafail Katsampas
2024-11-19 05:49:44 +02:00
committed by GitHub
parent 4e54c676a3
commit 712a9f4848
6 changed files with 10 additions and 22 deletions

View File

@ -26,7 +26,6 @@ function makePropertyEnumConverter<T>(enumValues) {
export const accessibilityEnabledProperty = new CssProperty<Style, boolean>({
name: 'accessible',
defaultValue: true,
cssName: 'a11y-enabled',
valueConverter: booleanConverter,
});

View File

@ -832,9 +832,7 @@ 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 {

View File

@ -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
*/

View File

@ -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 {

View File

@ -194,9 +194,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
}
super.onLoaded();
if (this.accessible) {
setupAccessibleView(this);
}
setupAccessibleView(this);
}
public _closeAllModalViewsInternal(): boolean {

View File

@ -3,22 +3,10 @@ import { CoreTypes } from '../../core-types';
import { View, CustomLayoutView, AddChildFromBuilder } from '../core/view';
import { booleanConverter, getViewById } from '../core/view-base';
import { Property } from '../core/properties';
import { accessibilityEnabledProperty } from '../../accessibility/accessibility-properties';
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
private _subViews = new Array<View>();
constructor() {
super();
/**
* mark accessible as false without triggering property change
* equivalent to changing the default
* TODO: Remove this when we have a more flexible API for declaring default property values per type of view
*/
this.style[accessibilityEnabledProperty.key] = false;
}
public _addChildFromBuilder(name: string, value: any) {
if (value instanceof View) {
this.addChild(value);