You can add data-menu-closer="true" to the link/button.
We use this in a few places.
Whenever there's a menu item that performs an action but you want that to also trigger the menu to close, we use it there. For example the post action bar when it collapses to a menu for one or two options in there, or the Close/Open thread link in the thread tools menu.
More recently, we've used it in the emoji menu in the editor. Although it may not immediately seem like it, that's actually a standard XF menu we display there rather than anything related to the editor itself. The close button there uses the data-menu-closer attribute to close the menu.