8000 revert: "perf: disable accessibility for layout views" (#10649) · CatchABus/NativeScript@712a9f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 712a9f4

Browse files
authored
revert: "perf: disable accessibility for layout views" (NativeScript#10649)
1 parent 4e54c67 commit 712a9f4

File tree

6 files changed

+10
-22
lines changed

6 files changed

+10
-22
lines changed

packages/core/accessibility/accessibility-properties.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function makePropertyEnumConverter<T>(enumValues) {
2626

2727
export const accessibilityEnabledProperty = new CssProperty<Style, boolean>({
2828
name: 'accessible',
29-
defaultValue: true,
3029
cssName: 'a11y-enabled',
3130
valueConverter: booleanConverter,
3231
});

packages/core/ui/core/view/index.android.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,7 @@ export class View extends ViewCommon {
832832
[accessibilityEnabledProperty.setNative](value: boolean): void {
833833
this.nativeViewProtected.setFocusable(!!value);
834834

835-
if (value) {
836-
updateAccessibilityProperties(this);
837-
}
835+
updateAccessibilityProperties(this);
838836
}
839837

840838
[accessibilityIdentifierProperty.setNative](value: string): void {

packages/core/ui/core/view/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ export abstract class View extends ViewCommon {
228228
*/
229229
color: Color;
230230

231+
/**
232+
* If `true` the element is an accessibility element and all the children will be treated as a single selectable component.
233+
*/
234+
accessible: boolean;
235+
231236
/**
232237
* Hide the view and its children from the a11y service
233238
*/

packages/core/ui/core/view/index.ios.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,8 @@ export class View extends ViewCommon implements ViewDefinition {
683683

684684
[accessibilityEnabledProperty.setNative](value: boolean): void {
685685
this.nativeViewProtected.isAccessibilityElement = !!value;
686-
if (value) {
687-
updateAccessibilityProperties(this);
688-
}
686+
687+
updateAccessibilityProperties(this);
689688
}
690689

691690
[accessibilityIdentifierProperty.getDefault](): string {

packages/core/ui/core/view/view-common.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
194194
}
195195
}
196196
super.onLoaded();
197-
if (this.accessible) {
198-
setupAccessibleView(this);
199-
}
197+
198+
setupAccessibleView(this);
200199
}
201200

202201
public _closeAllModalViewsInternal(): boolean {

packages/core/ui/layouts/layout-base-common.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,10 @@ import { CoreTypes } from '../../core-types';
33
import { View, CustomLayoutView, AddChildFromBuilder } from '../core/view';
44
import { booleanConverter, getViewById } from '../core/view-base';
55
import { Property } from '../core/properties';
6-
import { accessibilityEnabledProperty } from '../../accessibility/accessibility-properties';
76

87
export class LayoutBaseCommon extends CustomLayoutView implements LayoutBaseDefinition, AddChildFromBuilder {
98
private _subViews = new Array<View>();
109

11-
constructor() {
12-
super();
13-
14-
/**
15-
* mark accessible as false without triggering property change
16-
* equivalent to changing the default
17-
* TODO: Remove this when we have a more flexible API for declaring default property values per type of view
18-
*/
19-
this.style[accessibilityEnabledProperty.key] = false;
20-
}
21-
2210
public _addChildFromBuilder(name: string, value: any) {
2311
if (value instanceof View) {
2412
this.addChild(value);

0 commit comments

Comments
 (0)
0