-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: Clear the active menu state when closing the sidebar #25957
Conversation
Size Change: +593 B (0%) Total Size: 1.19 MB
ℹ️ View Unchanged
|
🤔 Actually I prefer it to open the last active menu. Anyway, I'm OK with with clearing the state. Maybe it's better a11y wise? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested template and template part navigation from the sidebar. Closing and reopening the sidebar always reset the state as expected.
✅ Chrome
✅ Firefox
✅ Edge
✅ Safari
✅ IE11
I don't have a strong opinion, but I'm curious about this as well. Do you happen to know the reasoning @Copons? |
if ( ! isActive ) { | ||
return null; | ||
} | ||
|
||
const handleClick = ( event ) => { | ||
if ( isOpen ) { | ||
setNavigationPanelActiveMenu(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking
:
Definitely nitpicky, but I would prefer invoking setNavigationPanelActiveMenu
with "root" (like so setNavigationPanelActiveMenu("root")
) because it is more explicit. Curious to hear your thoughts though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasoning would be that root
is part of the component's logic, and it shouldn't be a concern of the consumer.
On the other hand, the consumer still needs to know of that keyword to create nested menus, so yeah I guess it's not really an essential change.
I'll update to add root
back into the navigation panel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we update the specs for packages/edit-site/src/store/test/reducer.js
?
Edit: I accidentally approved this early, but +1 from me whenever the specs are set up 🙂
@david-szabo97 @jeyip
|
That all makes sense. Especially this
Once tests are passing I'll review again and you might get an approval from me 😛 |
Thanks for elaborating Jacopo! That all makes sense to me as well. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Thanks for the merge @ntsekouras! 🙇♂️ |
Description
The Site Editor's navigation sidebar keeps its active menu state in the
edit-site
store.Though, the state wasn't cleared when closing the sidebar, so reopening it would automatically enter whatever menu was left active before.
This PR clears the active menu state of the Site Editor sidebar when it's closed, so that reopening it will enter the root menu.
How has this been tested?
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: