Skip to content
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

Overlay side-panel in autohide mode. #1100

Merged
merged 5 commits into from
Aug 3, 2021
Merged

Conversation

Rohitth007
Copy link
Collaborator

@Rohitth007 Rohitth007 commented Jul 25, 2021

What does this PR do?
This commit makes the side panels to overlay the body which avoids
squashing and stretching of the message view which improves UX in
autohide mode.

Tested?

  • Manually
  • Existing tests (adapted, if necessary)
  • New tests added (for any new behavior)
  • Passed linting & tests (each commit)

Commit flow

Notes & Questions

Built on PR #1097

Interactions

Waiting on PR #1097
Blocks PR #1074

Visual changes
image

@zulipbot zulipbot added the size: XL [Automatic label added by zulipbot] label Jul 25, 2021
@Rohitth007 Rohitth007 added PR needs review PR requires feedback to proceed PR blocks other PR labels Jul 25, 2021
@Rohitth007 Rohitth007 force-pushed the panel-overlay branch 6 times, most recently from 97019dd to 9bd5323 Compare July 28, 2021 05:23
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rohitth007 Thanks for working on this - it seems that people have generally come out in support of the change 👍

The feature works fine; my feedback is mainly focused on clarifying the implementation.

zulipterminal/ui.py Outdated Show resolved Hide resolved
zulipterminal/ui.py Show resolved Hide resolved
Comment on lines +231 to +229
# FIXME: This can be avoided after fixing the "sacrificing 1st
# unread msg" issue and setting focus_column=1 when initializing.
self.body.focus_position = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this further?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neiljp The best way to understand this is to comment out the line and run it.

Basically keypress pretty much handles navigation focus change for us but except when initialization we make the left_tab as the focus_column (which is actually not a selectable widget but can be forcefully focused like we did)

To work around that we have to initialize focus_column as center_panel but that would mean a message would be read at startup. Hence, the FIXME.

The reordering below is a result of this change. Though it actually works fine without it, the tests broke hence the reordering.

The reordering actually also connects the 2nd commit in #1072 (redirecting keypress)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in the stream, but while I can confirm this does resolve one problem with setting focus, it doesn't solve opening compose or message-search from a panel, and I suggest we may want to use get/set_focus_path for this in general.

Comment on lines -231 to +259
self.body.focus_position = 2
self.users_view.keypress(size, key)
self.show_left_panel(visible=False)
self.show_right_panel(visible=True)
self.body.focus_position = 2
self.users_view.keypress(size, key)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this move is related to the focus setting in the panel methods - which we've just removed?
(this now overrides that being set there)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's because of the override but this was not the one we removed in one of the previous refactor commits. That was focus_setting when visible = True this is when visible = False

tests/ui/test_ui.py Outdated Show resolved Hide resolved
@neiljp neiljp added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback and removed PR needs review PR requires feedback to proceed labels Jul 28, 2021
@Rohitth007 Rohitth007 added PR needs review PR requires feedback to proceed and removed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Jul 29, 2021
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rohitth007 The first two commits are fine refactors, there are just a few challenges left with the overlay UI as per the stream.

Comment on lines +231 to +229
# FIXME: This can be avoided after fixing the "sacrificing 1st
# unread msg" issue and setting focus_column=1 when initializing.
self.body.focus_position = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in the stream, but while I can confirm this does resolve one problem with setting focus, it doesn't solve opening compose or message-search from a panel, and I suggest we may want to use get/set_focus_path for this in general.

tests/ui/test_ui.py Show resolved Hide resolved
@neiljp neiljp added PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback and removed PR needs review PR requires feedback to proceed labels Jul 29, 2021
@Rohitth007 Rohitth007 force-pushed the panel-overlay branch 4 times, most recently from 98baa8f to 06a6055 Compare August 1, 2021 08:10
This commit refactors `main_window` to use `show_left_panel` to show
the left panel at startup instead of hardcoding it in `body`.

Tests updated.
This commit stores the Fame widget of View as an attribute so that
it can be easily manipulated for various purposes like overlaying
widgets , adding padding, etc.

Tests added.
This commit makes sure the side-panels close in all cases where the
focus is set to center_panel, i.e.,
* special narrow hotkeys
* message search
* message compose (pm & stream)
* open draft

Tests updated.
This commit combines the tests for show_panel methods as they share
a lot of commonalities.
This commit makes the side panels overlay the body which avoids
squashing and stretching of the message view, which improves UX in
autohide mode.

To do this the `show_panel` functions have been updated to use
Overlay.

The focus setting in the `show_panel` functions which could be
avoided at a later point needed a reordering in the SEARCH keypress
which actually makes it the correct order, i.e.,
* first handle autohide
* then handle search

Tests updated.
@neiljp
Copy link
Collaborator

neiljp commented Aug 3, 2021

@Rohitth007 Thanks for the work that's gone into this! I've only slightly adjusted the overlay options list to make the code more compact, and am now merging 🎉

@neiljp neiljp merged commit 565d249 into zulip:main Aug 3, 2021
@neiljp neiljp added area: UI General user interface update and removed PR awaiting update PR has been reviewed & is awaiting update or response to reviewer feedback labels Aug 3, 2021
@neiljp neiljp added this to the Next Release milestone Aug 3, 2021
@Rohitth007 Rohitth007 deleted the panel-overlay branch August 3, 2021 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UI General user interface update PR blocks other PR size: XL [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants