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
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
Unknown Object (File)
Tue, Oct 22, 5:16 PM
Unknown Object (File)
Tue, Oct 22, 5:16 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.