Sidepanel visibility on canvas focus #1173
Merged
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.
When a canvas is focused, it takes 3 clicks on the TOC icon to open the side panel. This PR fixes that so that one click toggles the side panel open or closed.
Steps to reproduce:
Discussion:
The issue seems to be that most of the visibility logic is in
Mirador.Window.sidePanelVisibility()
but there's also a little bit inMirador.SidePanel.render()
, and those two can and do get out of sync. Based on how the code is currently written, it seemed to make the most sense to just get rid of the visibility logic inMirador.SidePanel
and simply letMirador.Window
handle that (at least for now -- maybe a later refactor will change that).This change shouldn't impact the logic around rendering the panel open/closed initially, since
sidePanelVisibility()
is determined bysettings.sidePanelVisible
the first time it is called. The tab objects contained in the side panel appear to override that setting if they detect no content. Subsequent changes to visibility are carried through window updates as the value ofwindow.sidePanelVisible
is toggled.@rsinghal @aeschylus Do you see any problems with this change?