-
-
Notifications
You must be signed in to change notification settings - Fork 851
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
Animations "leak" into nested drawers #1457
Comments
Thanks for posting this. I'm wondering if we can stop propagation instead, the challenge being the listener is currently on the document (maybe it shouldn't be). |
I've updated the code pen to call I think the challenge there is that the "parent" drawer fires an |
Ah sorry, I realize now you probably meant the It seems like that's already what Shoelace is trying to do here: shoelace/src/components/drawer/drawer.ts Lines 155 to 156 in a2e58b7
document then there's no propagation left to stop. Possibly moving the listener to the base (or overlay) would fix it?
I'm not yet set up to actually develop Shoelace itself, but I could take a stab at it tomorrow if you think that's a viable approach. |
Yeah, exactly. We may need to move it up, which should be OK since drawers are modal and focus should technically never be outside of them. It's worth a try. |
It looks like the event handler used to be bound on the base However, #925 was about scrolling and the issue with |
Good catch. Let me know if I can help in any way! |
This restores the stacking behaviour of drawers See: shoelace-style#1457
* Move keydown handler for sl-drawer back to base div This restores the stacking behaviour of drawers See: #1457 * Autofocus panel of sl-drawer when it is open on firstUpdate
I managed to fix this in a much simpler way. I used the existing stack for modals to ensure only the active drawer/dialog is closed. This solves your original use case and all tests are green. Thanks again for reporting this! |
Nice, I’m glad it worked out in a simpler way. Looking forward to the next release 🙂 |
Describe the bug
To Reproduce
Steps to reproduce the behavior:
Have nested
sl-drawer
elements:Add an
sl-request-close
event handler to the parent drawer that prevents it from being closed.Open both drawers
Add a breakpoint on this line
shoelace/src/components/drawer/drawer.ts
Line 138 in a2e58b7
Press
Escape
Note that the "child" drawer is animated when closing of the "parent" drawer is prevented.
Demo
CodePen: https://codepen.io/grncdr/pen/RwqMOOe
The code pen also illustrates how I ended up here: I wanted drawers to "stack" so that pressing Escape would only close the most recently opened drawer.
I would be happy to "fix" this bug by integrating the
drawerStack
concept directly into thesl-drawer
component, so thatEscape
only attempts to close the "top" drawer.Browser / OS
Note: the visual issues are much worse on Firefox.
Additional information
Provide any additional information about the bug here.
The text was updated successfully, but these errors were encountered: