1e41f4b71Sopenharmony_ci# Accessibility Hover Event
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciWhen accessibility mode is enabled, touch events are converted into accessibility hover events.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  - The initial APIs of this module are supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci>  - Currently, conversion into accessibility hover events can only be initiated by enabling accessibility mode.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## onAccessibilityHover
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_cionAccessibilityHover(callback: AccessibilityCallback): T
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciInvoked in accessibility mode when a single finger touches the bound component.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci**Parameters**
19e41f4b71Sopenharmony_ci| Name       | Type                   | Mandatory | Description                         |
20e41f4b71Sopenharmony_ci| ---------- | -------------------------- | ------- | ----------------------------- |
21e41f4b71Sopenharmony_ci| callback      | [AccessibilityCallback](#accessibilitycallback) | Yes  |  Callback invoked in accessibility mode when a single finger touches the bound component.|
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**Return value**
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci| Type| Description|
26e41f4b71Sopenharmony_ci| -------- | -------- |
27e41f4b71Sopenharmony_ci| T | Current component.|
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci## AccessibilityCallback
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_citype AccessibilityCallback = (isHover: boolean, event: AccessibilityHoverEvent) => void
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ciRepresents the accessibility hover event callback, which is effective when accessibility mode is enabled.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Parameters**
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci| Name             | Type                               | Mandatory| Description                                                        |
40e41f4b71Sopenharmony_ci| ------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ |
41e41f4b71Sopenharmony_ci| isHover             | boolean                             | Yes  | Whether a finger is hovering over the component in accessibility mode. The value **true** means that the finger enters the component, and **false** means that the finger leaves the component.|
42e41f4b71Sopenharmony_ci| event | [AccessibilityHoverEvent](#accessibilityhoverevent) | Yes  | **AccessibilityHoverEvent** object.                                  |
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci## AccessibilityHoverEvent
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ciInherits from [BaseEvent](ts-gesture-customize-judge.md#baseevent).
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci| Name             | Type      | Description     |
51e41f4b71Sopenharmony_ci| --------------- | ---------- | ------- |
52e41f4b71Sopenharmony_ci| type             | [AccessibilityHoverType](#accessibilityhovertype) | Accessibility hover type.               |
53e41f4b71Sopenharmony_ci| x                      | number                         | X coordinate of the finger's position relative to the upper left corner of the component being touched.<br>Unit: vp<br>|
54e41f4b71Sopenharmony_ci| y                      | number                         | Y coordinate of the finger's position relative to the upper left corner of the component being touched.<br>Unit: vp<br>|
55e41f4b71Sopenharmony_ci| windowX                | number                         | X coordinate of the finger's position relative to the upper left corner of the application window.<br>Unit: vp<br>|
56e41f4b71Sopenharmony_ci| windowY                | number                         | Y coordinate of the finger's position relative to the upper left corner of the application window.<br>Unit: vp<br>|
57e41f4b71Sopenharmony_ci| displayX               | number                         | X coordinate of the finger's position relative to the upper left corner of the display.<br>Unit: vp<br>|
58e41f4b71Sopenharmony_ci| displayY               | number                         | Y coordinate of the finger's position relative to the upper left corner of the display.<br>Unit: vp<br>|
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci## AccessibilityHoverType
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ciEnumerates the accessibility hover types.
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci| Name   | Value  | Description                              |
65e41f4b71Sopenharmony_ci| ------- | ---- | ---------------------------------- |
66e41f4b71Sopenharmony_ci| HOVER_ENTER | 0    | A finger is pressed.|
67e41f4b71Sopenharmony_ci| HOVER_MOVE  | 1    | The touch moves.|
68e41f4b71Sopenharmony_ci| HOVER_EXIT  | 2    | The finger is lifted.|
69e41f4b71Sopenharmony_ci| HOVER_CANCEL | 3    | The current event is canceled.|
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci## Example
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci```ts
74e41f4b71Sopenharmony_ci// xxx.ets
75e41f4b71Sopenharmony_ci@Entry
76e41f4b71Sopenharmony_ci@Component
77e41f4b71Sopenharmony_cistruct OnAccessibilityHoverEventExample {
78e41f4b71Sopenharmony_ci  @State hoverText: string = 'no hover';
79e41f4b71Sopenharmony_ci  @State color: Color = Color.Blue;
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci  build() {
82e41f4b71Sopenharmony_ci    Column({ space: 20 }) {
83e41f4b71Sopenharmony_ci      Button(this.hoverText)
84e41f4b71Sopenharmony_ci        .width(180).height(80)
85e41f4b71Sopenharmony_ci        .backgroundColor(this.color)
86e41f4b71Sopenharmony_ci        .onAccessibilityHover((isHover: boolean, event: AccessibilityHoverEvent) => {
87e41f4b71Sopenharmony_ci          // Use the onAccessibilityHover event to dynamically change the text content and background color of a button when the finger is hovered on it.
88e41f4b71Sopenharmony_ci          if (isHover) {
89e41f4b71Sopenharmony_ci            this.hoverText = 'hover';
90e41f4b71Sopenharmony_ci            this.color = Color.Pink;
91e41f4b71Sopenharmony_ci          } else {
92e41f4b71Sopenharmony_ci            this.hoverText = 'no hover';
93e41f4b71Sopenharmony_ci            this.color = Color.Blue;
94e41f4b71Sopenharmony_ci          }
95e41f4b71Sopenharmony_ci        })
96e41f4b71Sopenharmony_ci    }.padding({ top: 30 }).width('100%')
97e41f4b71Sopenharmony_ci  }
98e41f4b71Sopenharmony_ci}
99e41f4b71Sopenharmony_ci```
100