Page MenuHomePhabricator

[web] Prevent web Menu from dismissing itself on open
ClosedPublic

Authored by ashoat on Dec 23 2022, 10:11 AM.
Tags
None
Referenced Files
F3266291: D6016.id20075.diff
Sat, Nov 16, 1:51 AM
F3262652: D6016.diff
Fri, Nov 15, 11:46 PM
Unknown Object (File)
Tue, Nov 5, 4:07 AM
Unknown Object (File)
Mon, Nov 4, 11:24 AM
Unknown Object (File)
Mon, Nov 4, 11:23 AM
Unknown Object (File)
Mon, Nov 4, 11:22 AM
Unknown Object (File)
Mon, Nov 4, 10:51 AM
Unknown Object (File)
Mon, Nov 4, 1:19 AM
Subscribers
None

Details

Summary

Some change in React 18 is making document.addEventListener('click', closeMenuCallback) execute faster than before, and somehow it's able to catch the click that created it. Not sure how this is happening, but the fix is easy: stop the propagation of the click event once we handle it.

This solves https://linear.app/comm/issue/ENG-2534/cant-press-three-dots-button-in-messagelist-on-web

Test Plan

Make sure I can open the "three dots" menu in the MessageList on web

Diff Detail

Repository
rCOMM Comm
Branch
ashoat/fixlandingbg
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ashoat published this revision for review.Dec 23 2022, 10:16 AM

Should we check if there are other instances of document.addEventListener('click' to see if there might be additional issues?

This revision is now accepted and ready to land.Dec 23 2022, 10:16 AM

Remaining CI builds are irrelevant to web

In D6016#180701, @atul wrote:

Should we check if there are other instances of document.addEventListener('click' to see if there might be additional issues?

Good call.

ashoat@ashoatmbp2021 [~/src/comm/web]$ git grep "'click'"
components/menu.react.js:    document.addEventListener('click', closeMenuCallback);
components/menu.react.js:      document.removeEventListener('click', closeMenuCallback);
ashoat@ashoatmbp2021 [~/src/comm/web]$ cd ../landing/
ashoat@ashoatmbp2021 [~/src/comm/landing]$ git grep "'click'"
ashoat@ashoatmbp2021 [~/src/comm/landing]$

Looks like we're good!

This revision was landed with ongoing or failed builds.Dec 23 2022, 10:18 AM
This revision was automatically updated to reflect the committed changes.