Fix hide_sidebar option in Companion App #276
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 one opens and closes the sidebar, there is a logic behind to manage the Navigation Drawer and its focus trap.
If one hides the sidebar and applies all the styling override that
kiosk-modes
applies, the logic to remove all the inert blockers from the screen and to set all the elements in a closed state is never executed. This is not a problem for those that sethide_sidebar
globally in all the dashboards, but it is a problem if someone wants a dashboard without sidebar and navigates to it from a dashboard with it enabled, because in that moment the logic to close the sidebar is executed and as the sidebar never closes this provokes that it is impossible to interact with the interface.In this pull request a small fix has been introduced. Before hiding the sidebar, we are checking if the
type
of themc-drawer
element ismodal
(it occurs in mobile) and if itsappContent
has theinert
property set intrue
(in those cases it is impossible to interact with the screen). If that is the case, then we wait for the MDCDrawer:closed event of the Navigation Drawer, and only after it is fired, we apply the styles to hide the sidebar. In the rest of the cases we hide the sidebar directly without waiting for this event.Closes #275