Commit caa1fb6
Add ImportantForInteractionHelper for interaction handling (#55168)
Summary:
Pull Request resolved: #55168
Changelog: [Internal]
This diff introduces `ImportantForInteractionHelper`, a helper class that manages the `important_for_interaction` view tag. This tag determines how a view participates in interaction handling based on its `pointerEvents` value.
The helper provides a mapping from `PointerEvents` to `important_for_interaction` values:
- `AUTO` → `YES` (0x1)
- `NONE` → `NO | EXCLUDE_DESCENDANTS` (0x2 | 0x8)
- `BOX_ONLY` → `YES | EXCLUDE_DESCENDANTS` (0x1 | 0x8)
- `BOX_NONE` → `NO` (0x2)
This allows interaction detection systems to understand which views should participate in interaction handling based on their pointer events configuration, which is useful for features like Gaze-based interaction in accessibility and UI harvesting.
See design doc: https://docs.google.com/document/d/15Fi47zOHQh--KFWLUxQAUmBENgnZ0ZkYsKyOshPzBAo/edit?tab=t.0#heading=h.61xuoxksjdrp
Changes:
- Added `ImportantForInteractionHelper.kt` with constants and `setImportantForInteraction()` method
- Added `important_for_interaction` tag ID to `ids.xml`
- Updated `ReactViewManager.setPointerEvents()` to set the tag when pointer events change
- Updated `ReactViewGroup.initView()` to set the default tag value based on initial `PointerEvents.AUTO`
- Updated `BaseViewManager.prepareToRecycleView()` to clear the tag when recycling views
Reviewed By: javache, mdvacca
Differential Revision: D90386675
fbshipit-source-id: f0dab0111f2f5d14d5cb17769578804e2ddcbfe91 parent f1bedfb commit caa1fb6
File tree
6 files changed
+76
-0
lines changed- packages/react-native/ReactAndroid
- api
- src/main
- java/com/facebook/react
- uimanager
- views/view
- res/views/uimanager/values
6 files changed
+76
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3359 | 3359 | | |
3360 | 3360 | | |
3361 | 3361 | | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
3362 | 3370 | | |
3363 | 3371 | | |
3364 | 3372 | | |
| |||
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
| |||
packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
| 325 | + | |
324 | 326 | | |
325 | 327 | | |
326 | 328 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
77 | 80 | | |
0 commit comments