mirror of
https://github.com/discourse/discourse.git
synced 2025-03-29 09:25:37 +08:00

Followup to 17ba00c3950eb0a78dd510f3618f8e7be2d448fc. Fix for https://meta.discourse.org/t/-/261917 This fixes a usability issue where the user couldn't switch to the user menu when the search menu was visible and the text in the input was selected. Explanation: The `click` event is triggered both when clicking and when selecting some text and clicking. This means that when selecting text in the search input, at the end of the selection event, a click event was triggered. And if that click event happened to be outside of the search menu, then the menu would be dismissed. Previously, we fixed this by checked if a current text selection was present. But that results in a small side-effect of not switching to other menus. This PR switches to setting a flag during `mouseDown` and then using that flag when evaluating whether to trigger clickOutside or not.