Element-web: The right-pane keeps re-opening itself on window resize

Created on 18 Feb 2019  路  4Comments  路  Source: vector-im/element-web

Description

The right pane (listing members, files and notifications for a given room) keeps re-opening itself after being closed when the window is resized, when it should instead keep its last user-decided state.

Something similar is happening to the left pane (listing rooms), which is made narrow instead of keeping its width.

Steps to reproduce

  • Open a room.
  • Hide the right pane.
  • Resize the window to a smaller width.
  • Resize the window to a bigger width.
  • _The right pane is now shown again._

Version information

  • Platform: desktop
  • OS: Debian
  • Version: 1.0.1
bug p2 minor rightpanel

All 4 comments

Hmm, so far I can't seem to reproduce this. Do I need to first open a specific right pane, does it happen with any of them?

This works with all panes.
Here's a recording of the bug: the panel re-opens itself when the window is re-sized.

simplescreenrecorder-2019-02-19_12 19 55

Can only reproduce it when making the window so small that the right-hand pane gets auto-hidden.

Did some triaging, and the problem lies in matrix-react-sdk, which doesn't distinguish in its state model between "user hid the panel" and "panel was auto-hidden", which means that upon restoration of the original window size, it just blindly re-shows the panel as it has no way to know whether it was open or closed before the first resize.

In MatrixChat.js, the action to re-show the panel is dispatched from the handleResize method:

Selection_396

In the same file, that action results in the collapsedRhs state being set:

Selection_397

This then propagates down, eventually showing the panel again. However, there's no check at either of these points about whether the panel was originally open or closed. Because when the panel is explicitly closed by the user, it just dispatches a generic hide_right_panel action, which doesn't track the reason for the panel close:

Selection_399

If the panel were to be auto-closed, then it would dispatch the exact same action (in MatrixChat.js again), which means there's no way to distinguish the two cases:

Selection_400

The solution would be to:

  1. Track the user intent (explicit panel close) in a separate state property
  2. Check this state property upon un-resizing, to only re-show the panel if there was no explicit close before
  3. Clear the user intent property upon explicit panel open

I don't know whether there are any other parts of the codebase being touched by this that I'm not aware of. That should probably be checked by someone more familiar with the code than me :)

possibly related: #10149. dupe: #10156

Was this page helpful?
0 / 5 - 0 ratings