Skip to content

Commit b3e3a67

Browse files
Alex Danofffacebook-github-bot
Alex Danoff
authored andcommitted
W3CPointerEvents: change click event from direct to bubbling
Summary: AFAICT this was added in facebook#24359 to support accessibility, however per [the spec](https://www.w3.org/TR/uievents/#event-type-click) the click event is supposed to bubble up. This change updates the necessary configs so that `click` is treated as a bubbling event and not as a direct-dispatch event. Changelog: [Android] [Breaking] - W3CPointerEvents: change click event from direct to bubbling Reviewed By: yungsters Differential Revision: D45745906 fbshipit-source-id: 970ebf205725484d944e5276b04c61a3797bf858
1 parent 37fadad commit b3e3a67

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

packages/react-native/Libraries/NativeComponent/BaseViewConfig.android.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ const bubblingEventTypes = {
103103
bubbled: 'onPointerOver',
104104
},
105105
},
106+
topClick: {
107+
phasedRegistrationNames: {
108+
captured: 'onClickCapture',
109+
bubbled: 'onClick',
110+
},
111+
},
106112
};
107113

108114
const directEventTypes = {
@@ -135,9 +141,6 @@ const directEventTypes = {
135141
topMomentumScrollEnd: {
136142
registrationName: 'onMomentumScrollEnd',
137143
},
138-
topClick: {
139-
registrationName: 'onClick',
140-
},
141144
topLoadingStart: {
142145
registrationName: 'onLoadingStart',
143146
},

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ protected void onAfterUpdateTransaction(@NonNull T view) {
588588
MapBuilder.of(
589589
"phasedRegistrationNames",
590590
MapBuilder.of("bubbled", "onPointerOver", "captured", "onPointerOverCapture")))
591+
.put(
592+
"topClick",
593+
MapBuilder.of(
594+
"phasedRegistrationNames",
595+
MapBuilder.of("bubbled", "onClick", "captured", "onClickCapture")))
591596
.build());
592597
return eventTypeConstants;
593598
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
.put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart"))
6565
.put("topSelectionChange", MapBuilder.of(rn, "onSelectionChange"))
6666
.put("topMessage", MapBuilder.of(rn, "onMessage"))
67-
.put("topClick", MapBuilder.of(rn, "onClick"))
6867
// Scroll events are added as per task T22348735.
6968
// Subject for further improvement.
7069
.put("topScrollBeginDrag", MapBuilder.of(rn, "onScrollBeginDrag"))

0 commit comments

Comments
 (0)