Fix flaky search behaviour with minimized left pane #6817
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First time contributor checklist:
Contributor checklist:
main
branchyarn ready
run passes successfully (more about tests here)Description
Fixes #6255
The search input had some weird and quirky behaviour when the left pane was minimized down to its minimum width:
CMD+F
/CTRL+F
, the left pane would expand but the search box wouldn't be focusedCMD+SHIFT+F
/CTRL+SHIFT+F
, if you clicked thex
next to the conversation icon, the left pane would collapse instead of switching to global search modeI think it makes sense to collapse the left pane only when focus moves away from the search input and the search input is empty (i.e., no query and no conversation filter), so I implemented that and also made sure that the input receives focus when searching either globally or within a conversation.
Here's how global search looks now:
Screen.Recording.2024-03-08.at.11.10.52.PM.mov
And here's how conversation search looks:
Screen.Recording.2024-03-08.at.11.16.14.PM.mov
Here are the cases I manually tested:
CMD+F
, the left pane opens with the global search box focused ✅ESC
while in the search box, the left pane collapses ✅CMD+SHIFT+F
or click the magnifying glass in a conversation, the left pane opens with the conversation search box focused ✅x
next to the conversation icon or hitESC
, the conversation icon disappears, the now global search box stays focused, and the left pane stays open ✅I updated the existing tests and they're all passing. Let me know if there are other tests I could write that would be valuable.