Replies: 5 comments 5 replies
-
Did you mean drawer button? |
Beta Was this translation helpful? Give feedback.
-
I've one question, and maybe this is for design, but we have the idea of focus trapping in a Drawer. I wonder if we set the pattern that toggling the Button opens/closes a Drawer will create confusion when some Drawers have the trap enabled? We don't currently have an overlay to indicate the non-Drawer elements aren't interactive, so I'm curious if this pattern would introduce user frustration |
Beta Was this translation helpful? Give feedback.
-
I like the idea. Stacking seems like it could cause some UX strangeness. I haven't seen that pattern before, so I don't think we should offer something like that. The idea of reusing it for other interactive elements that open and close seems like a good one. |
Beta Was this translation helpful? Give feedback.
-
For the sake of referencing in the future, the need for this RFC arose from the following tickets: |
Beta Was this translation helpful? Give feedback.
-
Work completed in #2482 |
Beta Was this translation helpful? Give feedback.
-
RFC: Codifying drawer-toggling behavior
Problem
The design system provides a
<Drawer>
component that can open and close, sliding over other content on the screen. It does not, however, give guidance on how toggling these drawers should work or how multiple drawers should interact in a page. There are two common questions that application teams have related to the behavior of drawers:In order to create UX consistency within these sites, the design system should provide documentation and possibly code as well that prescribes these drawer behaviors.
Proposal
Based on previous discussions, I'm proposing we answer those two questions in the following ways:
These answers are open to debate. They are just what I gleaned from reviewing several conversations we've had with product teams.
We could answer these questions with documentation only. However, I like the idea of codifying it in our tools, so I'm proposing that as well. To accomplish this in code, I propose adding two new things:
useDrawerMananger
hook that provides everything you need to manage the toggle state of a drawer and its triggerDrawerManagerProvider
component that controls what happens when there are multiple drawers in play on the same pageThe hook can be used by itself to manage the state of a drawer and its toggle. If the hook is used in combination with the
DrawerManagerProvider
, every hook-managed drawer within the provider's subtree will respond to other drawers opening. More specifically, when a new drawer opens, other drawers will close. Alternatively, we could support multiple behaviors by adding a prop to the provider to specify the desired behavior (behavior="close"
orbehavior="stack"
).Benefits
Risks
Because this is opt-in behavior, my hope is that the risk is low. It requires no API changse to the existing
Drawer
orHelpDrawer
components.Questions and Feedback
Beta Was this translation helpful? Give feedback.
All reactions