Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Merged
merged 2 commits into from
Nov 19, 2024
Merged
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
4 changes: 1 addition & 3 deletions packages/core/ui/core/view/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
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
5 changes: 2 additions & 3 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
5 changes: 2 additions & 3 deletions packages/core/ui/core/view/view-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,8 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
}
super.onLoaded();
if (this.accessible) {
setupAccessibleView(this);
}

setupAccessibleView(this);
}

public _closeAllModalViewsInternal(): boolean {
Expand Down
12 changes: 0 additions & 12 deletions packages/core/ui/layouts/layout-base-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading