Skip to content
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

Only close sidebar if the event target is in body #64

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

TylerZeroMaster
Copy link
Contributor

@TylerZeroMaster TylerZeroMaster commented Dec 12, 2024

The svg for the left/right arrows were being swapped when the nav bar expanded. If this happened on click, the svg clicked would no longer be in the document and the nav bar would collapse immediately after expanding.

Stopping event prorogation in the click event was another way to fix this; however, that would leave the possibility of this happening again with a different sidebar nav element in the future. I think ignoring events that happened on nodes that are no longer in the document body will fix all similar cases too.

🐛 Demo

Note: You need to click a menu item in the top nav bar, like text resizer, before this behavior will emerge)

Screen.Recording.2024-12-11.at.11.36.08.AM.mov

The svg for the left/right arrows were being swapped when the nav bar expanded.
If this happened on click, the svg clicked would no longer be in the document
and the nav bar would collapse immediately after expanding.

Add a menu item to the sidebar story
Copy link
Contributor

@RoyEJohnson RoyEJohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might consider doing both. It seems to me that it is correct to stop propagation when you handle an event that could be re-handled when it propagates.
But I'll approve and leave that call up to you.

@TylerZeroMaster TylerZeroMaster merged commit 2105e04 into main Dec 12, 2024
2 checks passed
@TylerZeroMaster TylerZeroMaster deleted the mobile-sidebar-fix branch December 12, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants