Skip to content

Commit

Permalink
W3CPointerEvents: change click event from direct to bubbling (faceboo…
Browse files Browse the repository at this point in the history
…k#37539)

Summary:
Pull Request resolved: facebook#37539

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: 3c23d4ec82570e43eefd7295d301601396962ef0
  • Loading branch information
Alex Danoff authored and facebook-github-bot committed May 24, 2023
1 parent c37a5c0 commit 37f26ba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ const bubblingEventTypes = {
bubbled: 'onPointerOver',
},
},
topClick: {
phasedRegistrationNames: {
captured: 'onClickCapture',
bubbled: 'onClick',
},
},
};

const directEventTypes = {
Expand Down Expand Up @@ -135,9 +141,6 @@ const directEventTypes = {
topMomentumScrollEnd: {
registrationName: 'onMomentumScrollEnd',
},
topClick: {
registrationName: 'onClick',
},
topLoadingStart: {
registrationName: 'onLoadingStart',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ protected void onAfterUpdateTransaction(@NonNull T view) {
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of("bubbled", "onPointerOver", "captured", "onPointerOverCapture")))
.put(
"topClick",
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of("bubbled", "onClick", "captured", "onClickCapture")))
.build());
return eventTypeConstants;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
.put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart"))
.put("topSelectionChange", MapBuilder.of(rn, "onSelectionChange"))
.put("topMessage", MapBuilder.of(rn, "onMessage"))
.put("topClick", MapBuilder.of(rn, "onClick"))
// Scroll events are added as per task T22348735.
// Subject for further improvement.
.put("topScrollBeginDrag", MapBuilder.of(rn, "onScrollBeginDrag"))
Expand Down

0 comments on commit 37f26ba

Please sign in to comment.