discourse/app
Mark VanLandingham 64438fff25
FIX: Bind events properly in search-menu.js & fix focus issue (#25006)
The problem:
Removing the options to addEventListener results in events that are properly cleaned up when the search menu is removed. Previously every time you opened the search menu, the listeners would be attached again, and clicking outside even after it was closed would fire the function again and again (N times as you opened the search menu!)

This was made far far worse in this commit c91d053, where I called close() to remove focus from the search input in the event that the search menu is rendered outside the header.

The problem with this was 2-fold. The close function tried to focus the search header button in core here. When the events aren't cleanup up and that happens... you can't do anything in the app.

The solution:
We don't need the event listeners to close the search menu when it's rendered from the header. The widget header handles clicks outside of the header. Sooo

1. Only register them for standalone search menus
2. Remove the passive options to the listeners so that they are properly removed on close
3. Call close() to unfocus input rather than just closing panel
4. Rename passed in are closeSearchMenu -> onClose because it's more accurate. It's really a callback.
2023-12-22 09:48:00 -06:00
..
assets FIX: Bind events properly in search-menu.js & fix focus issue (#25006) 2023-12-22 09:48:00 -06:00
controllers FIX: Update position on model when re-positioning record (#24997) 2023-12-21 10:15:10 +08:00
helpers DEV: Simplify ember-cli proxy strategy (#24242) 2023-11-10 11:16:06 +00:00
jobs DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
mailers FIX: Add higher read & open timeouts for group SMTP emails (#24593) 2023-11-28 15:32:59 +10:00
models FIX: Update position on model when re-positioning record (#24997) 2023-12-21 10:15:10 +08:00
serializers DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
services DEV: lint against Layout/EmptyLineBetweenDefs (#24914) 2023-12-15 23:46:04 +08:00
views FIX: Remove old 'wizard' js script (#24986) 2023-12-20 14:01:43 +00:00