Skip to content

Commit

Permalink
W3CPointerEvents: change click event from direct to bubbling (#37539)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37539

AFAICT this was added in #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: 94ea6c5a84120f35a4fa6044b08462b0cb1a77e7
  • Loading branch information
Alex Danoff authored and facebook-github-bot committed May 25, 2023
1 parent bdeb09b commit e03c63b
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 e03c63b

Please sign in to comment.