pmusaraj
(Penar Musaraj)
April 21, 2023, 6:34pm
15
Thanks, this should be fixed via:
main ← search-selection-tweak
merged 06:30PM - 21 Apr 23 UTC
Followup to 17ba00c3950eb0a78dd510f3618f8e7be2d448fc. Fix for https://meta.disco… urse.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 text. This means that when selecting text in the search input, at the end of the selection event, a click event is triggered. And if that click event happens outside of the search menu (i.e. when you continue dragging outside the input), then the menu would be dismissed.
Previously, we fixed this by checked for the presence of a current text selection. But that results in a small side-effect reported in the linked issue on meta. This PR sets a flag during `mouseDown` when starting a text selection in the input and then it uses that flag when evaluating whether to trigger `clickOutside` or not.
There’s a long-ish explanation in the PR description, the short version is that we were previously skipping the clickOutside event for the search menu when there was text selected. But we auto-select the search menu input text, so this switches to a different technique.
4 Likes