mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
revert: "perf: disable accessibility for layout views" (#10649)
This commit is contained in:

committed by
GitHub

parent
4e54c676a3
commit
712a9f4848
@ -26,7 +26,6 @@ function makePropertyEnumConverter<T>(enumValues) {
|
|||||||
|
|
||||||
export const accessibilityEnabledProperty = new CssProperty<Style, boolean>({
|
export const accessibilityEnabledProperty = new CssProperty<Style, boolean>({
|
||||||
name: 'accessible',
|
name: 'accessible',
|
||||||
defaultValue: true,
|
|
||||||
cssName: 'a11y-enabled',
|
cssName: 'a11y-enabled',
|
||||||
valueConverter: booleanConverter,
|
valueConverter: booleanConverter,
|
||||||
});
|
});
|
||||||
|
@ -832,9 +832,7 @@ export class View extends ViewCommon {
|
|||||||
[accessibilityEnabledProperty.setNative](value: boolean): void {
|
[accessibilityEnabledProperty.setNative](value: boolean): void {
|
||||||
this.nativeViewProtected.setFocusable(!!value);
|
this.nativeViewProtected.setFocusable(!!value);
|
||||||
|
|
||||||
if (value) {
|
updateAccessibilityProperties(this);
|
||||||
updateAccessibilityProperties(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[accessibilityIdentifierProperty.setNative](value: string): void {
|
[accessibilityIdentifierProperty.setNative](value: string): void {
|
||||||
|
5
packages/core/ui/core/view/index.d.ts
vendored
5
packages/core/ui/core/view/index.d.ts
vendored
@ -228,6 +228,11 @@ export abstract class View extends ViewCommon {
|
|||||||
*/
|
*/
|
||||||
color: Color;
|
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
|
* Hide the view and its children from the a11y service
|
||||||
*/
|
*/
|
||||||
|
@ -683,9 +683,8 @@ export class View extends ViewCommon implements ViewDefinition {
|
|||||||
|
|
||||||
[accessibilityEnabledProperty.setNative](value: boolean): void {
|
[accessibilityEnabledProperty.setNative](value: boolean): void {
|
||||||
this.nativeViewProtected.isAccessibilityElement = !!value;
|
this.nativeViewProtected.isAccessibilityElement = !!value;
|
||||||
if (value) {
|
|
||||||
updateAccessibilityProperties(this);
|
updateAccessibilityProperties(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[accessibilityIdentifierProperty.getDefault](): string {
|
[accessibilityIdentifierProperty.getDefault](): string {
|
||||||
|
@ -194,9 +194,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onLoaded();
|
super.onLoaded();
|
||||||
if (this.accessible) {
|
|
||||||
setupAccessibleView(this);
|
setupAccessibleView(this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public _closeAllModalViewsInternal(): boolean {
|
public _closeAllModalViewsInternal(): boolean {
|
||||||
|
@ -3,22 +3,10 @@ import { CoreTypes } from '../../core-types';
|
|||||||
import { View, CustomLayoutView, AddChildFromBuilder } from '../core/view';
|
import { View, CustomLayoutView, AddChildFromBuilder } from '../core/view';
|
||||||
import { booleanConverter, getViewById } from '../core/view-base';
|
import { booleanConverter, getViewById } from '../core/view-base';
|
||||||
import { Property } from '../core/properties';
|
import { Property } from '../core/properties';
|
||||||
import { accessibilityEnabledProperty } from '../../accessibility/accessibility-properties';
|
|
||||||
|
|
||||||
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
|
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
|
||||||
private _subViews = new Array<View>();
|
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) {
|
public _addChildFromBuilder(name: string, value: any) {
|
||||||
if (value instanceof View) {
|
if (value instanceof View) {
|
||||||
this.addChild(value);
|
this.addChild(value);
|
||||||
|
Reference in New Issue
Block a user