-
Notifications
You must be signed in to change notification settings - Fork 58
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
layout_sidebar()
on mobile devices
#941
Comments
This is separating out as if these are two separate concerns--but I don't think they are?
I'm not saying we couldn't adopt the table of logic above, but the fact that it exposes so many logically inconsistent combinations smells like these don't "want" to be separate. What about what we discussed on the call? open=dict(
desktop="always|open|closed",
mobile="always|open|closed",
) ...in addition to continuing to support the simple strings and bools we do today. And maybe a new This would be trivially backwards compatible with what we have now (whereas splitting into two might not be, depending on what we choose as the default for |
It does get simpler if you take |
This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue. |
Problem
Currently, when using
layout_sidebar()
, users can either setopen="desktop"
to automatically initialize the sidebar in closed mode on mobile devices, oropen="auto"
to always show the sidebar on both mobile and desktop devices.There isn't a way to achieve a middle ground where the sidebar is always visible on mobile devices, but collapsible on desktop screens.
Proposal
I'm proposing we add a new argument,
collapsible
, with the optionsc("desktop", "mobile", "always", "never")
. The current behavior is equivalent toopen="desktop", collapsible="always"
, and in cases where users want the sidebar contents to be collapsible on desktop but always visible on mobile, the could changecollapsible="desktop"
.We'd support any combination of
open
andcollapsible
, other thanopen="closed", collapsible="never"
. Note thatopen
only applies when the sidebar is collapsible, soopen="closed", collapsible="desktop"
means that the sidebar is starts closed on desktop screens but can be opened, while it's always shown on mobile devices.Here's the full break down of behavior:
open=
collapsible=
"desktop"
"desktop"
"desktop"
"mobile"
"desktop"
"always"
"desktop"
"never"
"always"
"desktop"
"always"
"mobile"
"always"
"always"
"always"
"never"
"open"
"desktop"
"open"
"mobile"
"open"
"always"
"open"
"never"
"closed"
"desktop"
"closed"
"mobile"
"closed"
"always"
"closed"
"never"
A few patterns emerge from the above:
collapsible="never"
means that the sidebar is always visible, regardless of the value ofopen
. (open
is the initial state of a collapsible sidebar.)collapsible="desktop"
, the sidebar is always visible on mobile devices and vice-versa whencollapsible="mobile"
The above sounds complicated, but in practice the implementation would be to include information about whether not the sidebar can be collapsed at desktop or mobile and use that to decide if the sidebar is "always shown". E.g.
data-collapsible-desktop="false"
would hide the collapse toggle and ensure that the sidebar is always visible on desktop screens.The text was updated successfully, but these errors were encountered: