-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
view: Fix focus index before and after Panel Search. #978
Conversation
ERROR: Label "further discussion needed" does not exist and was thus not removed from this pull request. |
@zulipbot remove "further discussion required" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rohitth007 Thanks for putting the work through! This seems to work well. 👍
However, I think we could simplify the approach (see my in-line comment). I would encourage you to add tests so that we can ship it with more confidence.
Also, it is not apparent through the commit title where the search is being done. You might want to explicate it a bit more.
0868e44
to
64da010
Compare
64da010
to
b8fdbdd
Compare
b8fdbdd
to
1a42792
Compare
1a42792
to
b433eb8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rohitth007 Thanks for the update. This seems to work well! 👍
It would be good to have it in the User search as well while we're at it. It should be straightforward to implement.
The second commit looks good to me. However, I would strongly encourage you to accompany the changes with tests.
Re the first commit, let's see what Neil has to say about the refactor.
We could also have it for the user list but it wasn't there to begin with so I thought it wasn't needed. Also we have to make sure that if a user goes to the bottom of the list and come back to the message box, the list doesn't get stuck theme, as same section of code is used. I haven't checked if this would happen. |
A more useful feature would be to focus back to where it was before search if it was not in the list. Eg: If we are in the message view and press q, escaping should bring us back to that message. That doesn't happen currently but is also out of the scope of this PR |
Re tests, I'll update them by tomorrow 😅 |
@Rohitth007 I am not sure if I understand your first premise completely. Let's talk more about it on CZO. Re the latter, I had something similar while reviewing. Could you file an issue for the same as it is something that we can take up separately? |
b433eb8
to
0e82dbb
Compare
@preetmishra I have added some tests for this and removed bad tests which gave false positives |
0e82dbb
to
62bb0a0
Compare
I've implemented user list refocus in the 3rd commit. It needs some checking. |
eeecca5
to
982a848
Compare
I have updated the tests for user list refocusing as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rohitth007 This continues to work well functionally. Thanks for the update! 👍
We could potentially secure the tests for RightColumnView. I have left a few in-line comments related to tests.
@Rohitth007 Let's focus on the bugfix commit which functionally works well and tune that test 👍 We could incorporate the initial refactor into a more general clean-up like I mentioned. |
2957fd2
to
b7e3d55
Compare
I have made few changes as suggested and moved the bugfix commit to the top. I'll move the other commits into new PR's to be worked on separately. |
b7e3d55
to
b6e8e57
Compare
I have moved the other commits into separate branches. This is ready to be merged |
This commit corrects what the code for focus_index_before_search was intended to do. The focus index was still being updated even in the search results. This is fixed by moving `get_focus` into the SEARCH_STREAM/TOPIC conditional. Tests amended. Bad tests (`test_return_to_focus_after_search`) removed as they pass even though they don't do the right thing. Current tests fail before this commit. Fixes zulip#975.
b6e8e57
to
8423efc
Compare
@Rohitth007 Thanks for the test reworking 👍 There's still a lot of manual implementation-dependent setup going on in the tests which I'll be glad to see gone in future! Identifying the bugfix was a good find and this is small and clean to merge now 🎉 |
This PR corrects what the code for
focus_index_before_search
was intended to do. See #975The focus index was still being updated even in the search results.
This is fixed by moving
get_focus
into the SEARCH_STREAM/TOPICconditional.
Fixes #975