1e41f4b71Sopenharmony_ci# Accessibility 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciYou can set accessibility attributes and events for components. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## accessibilityGroup 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciaccessibilityGroup(value: boolean) 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ciSets the accessibility group. 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**Parameters** 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 24e41f4b71Sopenharmony_ci| ------ | ------- | ---- | ------------------------------------------------------------ | 25e41f4b71Sopenharmony_ci| value | boolean | Yes | Accessibility group. If this attribute is set to **true**, the component and all its child components form an entire selectable component, and the accessibility service will no longer be available for the content of its child components.<br>Default value: **false**| 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci## accessibilityText 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ciaccessibilityText(value: string) 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ciSets the accessibility text. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci**Parameters** 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 42e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 43e41f4b71Sopenharmony_ci| value | string | Yes | Accessibility text. If a component does not contain text information, it will not be read when the component is selected by the screen reader. In this case, the screen reader user cannot know which component is selected. To solve this problem, you can set this attribute for components without text information. When the component is selected by the screen reader, the specified accessibility text will be read, informing the user which component is selected.<br>Default value: **""**<br>**NOTE**<br>If a component with this attribute set contains text information, only the accessibility text will be read.<br>If a component with its **accessibilityGroup** attribute set to **true** does not have **accessibilityText** set and does not contain text information, text concatenation will be performed on its child components (depth first).| 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci## accessibilityText<sup>12+</sup> 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ciaccessibilityText(text: Resource) 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ciSets the accessibility text, which supports referencing resource files through **Resource**. 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci**Parameters** 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 60e41f4b71Sopenharmony_ci| ------ | ------ | ---- |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 61e41f4b71Sopenharmony_ci| text | [Resource](ts-types.md#resource) | Yes | Reference resource of accessibility text. If a component does not contain text information, it will not be read when the component is selected by the screen reader. In this case, the screen reader user cannot know which component is selected. To solve this problem, you can set this attribute for components without text information. When the component is selected by the screen reader, the specified accessibility text will be read, informing the user which component is selected.<br>**NOTE**<br>If a component with this attribute set contains text information, only the accessibility text will be read.<br>If a component with its **accessibilityGroup** attribute set to **true** does not have **accessibilityText** set and does not contain text information, text concatenation will be performed on its child components (depth first).| 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ci## accessibilityDescription 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ciaccessibilityDescription(value: string) 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ciSets the accessibility description. 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci**Parameters** 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 79e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 80e41f4b71Sopenharmony_ci| value | string | Yes | Accessibility description. You can specify further explanation of the current component, for example, possible operation consequences, especially those that cannot be learned from component attributes and accessibility text. If a component contains both text information and the accessibility description, the text is read first and then the accessibility description, when the component is selected.<br>Default value: **""**| 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ci## accessibilityDescription<sup>12+</sup> 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ciaccessibilityDescription(description: Resource) 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ciSets the accessibility description, which supports referencing resource files through **Resource**. 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci**Parameters** 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 97e41f4b71Sopenharmony_ci| ------ | ------ | ---- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 98e41f4b71Sopenharmony_ci| description | [Resource](ts-types.md#resource) | Yes | Reference resource of the accessibility description. You can specify further explanation of the current component, for example, possible operation consequences, especially those that cannot be learned from component attributes and accessibility text. If a component contains both text information and the accessibility description, the text is read first and then the accessibility description, when the component is selected.| 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci## accessibilityLevel 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ciaccessibilityLevel(value: string) 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ciSets the accessibility level. 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci**Parameters** 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 115e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 116e41f4b71Sopenharmony_ci| value | string | Yes | Accessibility level, which is used to decide whether a component can be identified by the accessibility service.<br>The options are as follows:<br>**"auto"**: The value is converted to **"yes"** or **"no"** based on the component.<br>**"yes"**: The current component is selectable for the accessibility service.<br>**"no"**: The current component is not selectable for the accessibility service.<br>**"no-hide-descendants"**: The current component and all its child components are not selectable for the accessibility service.<br>**Default value**: **"auto"**<br>**NOTE**<br>When the **accessibilityLevel** attribute of the following components is set to **"auto"**, they are selectable for the accessibility service: Checkbox, CheckboxGroup, Gauge, Marquee, MenuItem, MenuItemGroup, Menu, Navigation, DatePicker, Progress, Radio, Rating, ScrollBar, Select, Slider, Stepper, Text, TextClock, TextPicker, TextTimer, TimePicker, Toggle, Web.| 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci## accessibilityVirtualNode<sup>11+</sup> 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ciaccessibilityVirtualNode(builder: CustomBuilder) 121e41f4b71Sopenharmony_ci 122e41f4b71Sopenharmony_ciSets the accessibility virtual node. 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12. 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci**Parameters** 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 133e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------------------------------------------------------ | 134e41f4b71Sopenharmony_ci| builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Accessibility virtual node, which enables you to pass in a custom builder to the self-drawing component. The components in the custom builder are only laid out but not displayed at the backend. When the accessibility application obtains the accessibility node information, the node information in the custom builder is returned.| 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci## Example 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ci```ts 139e41f4b71Sopenharmony_ci// xxx.ets 140e41f4b71Sopenharmony_ci@Entry 141e41f4b71Sopenharmony_ci@Component 142e41f4b71Sopenharmony_cistruct Index { 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ci @Builder customAccessibilityNode() { 145e41f4b71Sopenharmony_ci Column() { 146e41f4b71Sopenharmony_ci Text(`virtual node`) 147e41f4b71Sopenharmony_ci } 148e41f4b71Sopenharmony_ci .width(10) 149e41f4b71Sopenharmony_ci .height(10) 150e41f4b71Sopenharmony_ci } 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci build() { 153e41f4b71Sopenharmony_ci Row() { 154e41f4b71Sopenharmony_ci Column() { 155e41f4b71Sopenharmony_ci Text ("Text 1") 156e41f4b71Sopenharmony_ci .fontSize(50) 157e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 158e41f4b71Sopenharmony_ci Text ("Text 2") 159e41f4b71Sopenharmony_ci .fontSize(50) 160e41f4b71Sopenharmony_ci .fontWeight(FontWeight.Bold) 161e41f4b71Sopenharmony_ci } 162e41f4b71Sopenharmony_ci .width('100%') 163e41f4b71Sopenharmony_ci .accessibilityGroup(true) 164e41f4b71Sopenharmony_ci .accessibilityLevel("yes") 165e41f4b71Sopenharmony_ci .accessibilityText ("Group") 166e41f4b71Sopenharmony_ci .accessibilityDescription("The <Column> component is selectable , and the text to be read out is "Group".) 167e41f4b71Sopenharmony_ci .accessibilityVirtualNode(this.customAccessibilityNode) 168e41f4b71Sopenharmony_ci } 169e41f4b71Sopenharmony_ci .height('100%') 170e41f4b71Sopenharmony_ci } 171e41f4b71Sopenharmony_ci} 172e41f4b71Sopenharmony_ci``` 173